Repository navigation
Studio: read the SDXL v-prediction markers beside the weight load and once per commit, skip the UNet scheme probe - #16696
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 718b8cfaee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| start_root_single_marks( | ||
| _base_local_dir or fetch_base, | ||
| fetch_base, | ||
| hub_token, | ||
| not local_files_only, |
There was a problem hiding this comment.
Bind the early marker read to the revision being loaded
For a direct load_pipeline() call without _base_local_dir, this starts the marker lookup against a Hub ID before from_pretrained() resolves its revision. If the cache's refs/main still points to commit A but the repository now serves commit B, _snapshot_commit() selects A and the future returns A's markers, while from_pretrained() subsequently downloads B. apply_pipeline_prediction_type() then unconditionally uses those precomputed markers, potentially applying v-prediction to epsilon weights (or vice versa) and corrupting generated images. Previously the lookup ran after the weight load updated the cached revision. Only overlap the read when the load has a staged, commit-pinned snapshot, or resolve and pin the same commit for both operations.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 49edb30: the overlapped read starts only when the base snapshot is staged locally (_base_local_dir, the commit from_pretrained loads). A Hub id resolves its revision inside from_pretrained, so it reads after the load as before (test_the_marker_read_overlaps_only_a_staged_snapshot).
A Hub id resolves its revision inside from_pretrained; an early read could take refs/main's older commit while the load downloads a newer one. [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
An SDXL pipeline load on an L4 took 24-25 s before the first image. Profiling one load (py-spy, fresh process, warm disk cache) showed two avoidable costs:
.safetensorsfile (base, 0.9 VAE, offset LoRA) one after another: 15 HTTP requests. A returning user paid it again (18 requests), although the result was already recorded per commit; only offline loads used the record.Change
diffusion_sampler.py:start_root_single_marksstarts the marker read on a daemon thread beforefrom_pretrained, with the caller's context copied, so the Hub reads overlap the weight load.apply_pipeline_prediction_type(..., marks_future=)waits for it; if the background read failed, it reads again inline.diffusion.py: the scheme probe is skipped for a UNet family with no prequant repos.test_diffusion_unet_skips_scheme_probe.py(new) andtest_diffusion_vpred_sdxl_detect.py(5 new tests; one existing assertion that required re-reading an already recorded commit now asserts no Hub call, and that a new commit is still read).Evidence
SDXL 1024x1024 on one L4, main vs this PR interleaved, output bit-identical:
Tests
Not covered