WaveCut commited on
Commit
7315dc5
·
verified ·
1 Parent(s): 1c9a468

Card: measured one-model-at-a-time offload (72.2 s, 50.4 GiB peak) and memory modes

Browse files
Files changed (2) hide show
  1. README.md +27 -7
  2. assets/speed_memory_size.png +2 -2
README.md CHANGED
@@ -61,6 +61,21 @@ name. Editing: pass `image=reference` (or a list) and refer to the images as `<P
61
  prompt. The prompting guidance of the original card applies unchanged: long, complete English descriptions;
62
  recommended sizes from 4096×4096 (1:1) to 6272×2688 (21:9).
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  The components also load alone with the stock classes: `MiniMaxH3ImageTransformer2DModel.from_pretrained(repo,
65
  subfolder="transformer")` and `Qwen3VLForConditionalGeneration.from_pretrained(repo, subfolder="text_encoder")`.
66
 
@@ -95,15 +110,20 @@ warm-up image. Time includes prompt encoding, six steps and VAE decoding.
95
 
96
  | Run | 2048×2048 | Edit, 2048×2048 | 4736×3552 | GPU memory peak, 4736×3552 |
97
  |---|---|---|---|---|
98
- | Original, model offload | 97.6 s | 101.6 s | 120.8 s | 68.2 GiB |
99
- | Pruned, model offload (code above) | 5.6 s | 9.4 s | 26.4 s | 92.7 GiB |
100
  | Pruned, all on the GPU (`pipe.to("cuda")`) | 5.6 s | 9.3 s | 26.7 s | 92.7 GiB |
101
 
102
- The time difference comes from memory, not from compute: the original (124 GiB of transformer and text encoder) does
103
- not fit a 96 GB card, so the offload manager moves both models for every image. The pruned models (86.4 GiB)
104
- stay on the GPU. The sampling steps themselves cost the same. On a GPU where the original fits (141 GB or more),
105
- expect similar times for both; on an 80 GB GPU the pruned models also take turns on the GPU, with less data to move
106
- (neither case was measured).
 
 
 
 
 
107
 
108
  ## Verification
109
 
 
61
  prompt. The prompting guidance of the original card applies unchanged: long, complete English descriptions;
62
  recommended sizes from 4096×4096 (1:1) to 6272×2688 (21:9).
63
 
64
+ ### Memory modes
65
+
66
+ `enable_auto_cpu_offload` moves a model off the GPU only when the next one does not fit. On a 96 GB card the pruned
67
+ models fit together, so after the first image nothing moves and the run is as fast as with everything on the GPU
68
+ (peak 92.7 GiB). For the lowest peak, keep one model on the GPU at a time; set the strategy after loading, because
69
+ adding the components resets it to the default:
70
+
71
+ ```python
72
+ pipe.load_components(dtype=torch.bfloat16)
73
+ manager.set_offload_strategy(lambda hooks, **kwargs: hooks) # move every other model off the GPU first
74
+ ```
75
+
76
+ The peak is then 50-52 GiB, set by the text encoder (48.9 GiB of weights), and each image moves both models over
77
+ PCIe: about 72 s at 2048×2048 instead of 5.6 s (see Profiles).
78
+
79
  The components also load alone with the stock classes: `MiniMaxH3ImageTransformer2DModel.from_pretrained(repo,
80
  subfolder="transformer")` and `Qwen3VLForConditionalGeneration.from_pretrained(repo, subfolder="text_encoder")`.
81
 
 
110
 
111
  | Run | 2048×2048 | Edit, 2048×2048 | 4736×3552 | GPU memory peak, 4736×3552 |
112
  |---|---|---|---|---|
113
+ | Original, model offload (code of the original card) | 97.6 s | 101.6 s | 120.8 s | 68.2 GiB |
114
+ | Pruned, one model on the GPU at a time | 72.2 s | 76.0 s | 92.8 s | 50.4 GiB (edit: 51.7 GiB) |
115
  | Pruned, all on the GPU (`pipe.to("cuda")`) | 5.6 s | 9.3 s | 26.7 s | 92.7 GiB |
116
 
117
+ The original does not fit a 96 GB card (124 GiB of transformer and text encoder), so the offload manager moves the
118
+ transformer and the text encoder for every image. With one model on the GPU at a time the pruned checkpoint does the
119
+ same, with 30 % less data to move. With everything on the GPU nothing moves; the stock auto offload (the code above)
120
+ measured the same on this card, 5.6 s / 9.4 s / 26.4 s with a 92.7 GiB peak. The sampling steps themselves cost the
121
+ same in all rows. GPUs with 80 GB or with 141 GB or more were not measured.
122
+
123
+ All rows ran on the same machine. With every model on the GPU (auto offload on this card included), the edit took
124
+ 14-22 s instead of 9.3 s in three of five runs: the text encoder's pass over the reference image took 5-9 s instead of
125
+ under 1 s. The cause is not identified; the table shows the fast runs.
126
+ With one model on the GPU at a time the images are bit-identical to the all-on-GPU ones.
127
 
128
  ## Verification
129
 
assets/speed_memory_size.png CHANGED

Git LFS Details

  • SHA256: 1304b5fda6e1fe420b35b3637fa66a86cee5850e68993f080433fa49b93510eb
  • Pointer size: 131 Bytes
  • Size of remote file: 154 kB

Git LFS Details

  • SHA256: 540d23f66a5ddcf4ad75167355acc10760c233323b9a046e480f7ffb90867a63
  • Pointer size: 131 Bytes
  • Size of remote file: 164 kB