enable_model_cpu_offload(): first post-load generation thrashes the Windows pagefile (~6x step time), silently recovers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- documentation, performance
Research direction
Start from enable_model_cpu_offload() and the cpu_offload documentation the issue asks to extend. The report is a Windows pagefile slowdown on the first generation after load, so the first step is to reproduce the timing pattern or confirm the explanation before writing anything. Done means a docs note describing the first-run slowdown on Windows hosts whose weights approach system RAM, reviewed by a maintainer who has confirmed the wording.
Written by the indexing model from the issue text.
Description
enable_model_cpu_offload(): first post-load generation thrashes the
Windows pagefile (~6x step time), silently recovers on the next run
Environment: Windows 11 26300, 32 GB RAM (31.8 usable), pagefile
system-managed (grew to ~55 GB cap, ~20 GB in use at observation), RX 7900
XTX 24 GB, torch 2.12.0+rocm7.14.1, accelerate 1.15.0, diffusers
QwenImage21Pipeline with enable_model_cpu_offload() (weights total
30.86 GB host-side: 7B DiT + 8B text encoder + VAE, bf16).
Measured (fixed seed/protocol, median per run):
| run (back-to-back, same process config) | steady s/step @1024² |
|---|---|
| cold (first load; OS file cache hot) | 3.6–3.7 |
| warmup run immediately after | 24–26 (6-7x slower) |
| measure run right after that | 3.66 (fully recovered) |
During the slow run the pagefile grew by ~20 GB. Interpretation: with
weights ≈ system RAM, the first post-load generation forces Windows to
commit/grow the pagefile while cpu_offload streams module weights;
the growth cost lands on that run's steps. Steady state has no per-step
paging (DiT stays resident in VRAM; only text-encoder transfers per
prompt). It self-recovers, so it is not a correctness bug — but for other
~32 GB-RAM Windows users the symptom ("first image after loading is
~6x slower, then everything is fine") is alarming and underdocumented.
Ask:
- A note in the
cpu_offloaddocs: on Windows hosts where total weights
approach system RAM, expect one sacrificial slow generation after the
first load (pagefile commit), recovering on subsequent runs. - (Stretch) Consider an explicit
torch.cuda.empty_cache()-style hint
or a warning whentotal_weights_bytes > 0.8 * total_ramthat the
first run may page-thrash, so benchmarks discard it.
Raw protocol data: 40-step runs, median-of-3 per run class
(bench evidence).
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 1.6k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 13
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from huggingface/accelerate
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/accelerate#4511 ·
Maintainers usually reply within 1 day
-
BatchSamplerShard padding mutates retained sampler batches and changes original loader samplesPossibly taken @davrens101 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
huggingface/accelerate#4505 ·
Maintainers usually reply within 1 day
-
accelerator.reduce(tensor, "mean") fails on integer tensors when more than one process is usedPossibly taken @MaiAditya claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/accelerate#4469 ·
Maintainers usually reply within 1 day
-
merge_fsdp_weights with remove_checkpoint_dir=True deletes the merged model when output_path is inside checkpoint_dirPossibly taken @assass1nlike claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
huggingface/accelerate#4514 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
huggingface/accelerate#4510 ·
Maintainers usually reply within 1 day
All issues in huggingface/accelerate
Similar issues
-
`destroy` sans terminal répond « Aborted. » au lieu de réclamer `--yes` comme `clean` et `reset`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
stephrobert/dsoxlab#354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
jasonacox/pypowerwall#472 ·
Maintainers usually reply within 1 day
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex failsPossibly taken @vrjdev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DoubleML/doubleml-for-py#455 ·
Maintainers usually reply within 1 day
-
[Bug]: Python mod.Box[T] annotation gets a false generic_arg edge that replaces the parameter_type one ('is' on tree-sitter nodes)Possibly taken @rohit-jsfreaky claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Graphify-Labs/graphify#5110 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
assafelovic/gpt-researcher#2277 ·
Maintainers usually reply within 10 days