Repository navigation
Tighten the gated-base preflight comments - #8003
Conversation
Comment-only pass over the ten files #7870 touched, now that it has landed: 311 insertions, 437 deletions, net -126 lines of comment text. Multi-paragraph docstrings squashed to single paragraphs, and eight copies of the same three-line preamble in test_diffusion_gated_base.py collapsed to one line each. Every non-obvious fact is kept, just shorter: huggingface_hub 1.x making response a required keyword-only argument, hf_raise_for_status folding 401 into RepositoryNotFoundError, expanduser raising RuntimeError rather than OSError, blobs/ being append-only across republished revisions, and why the memory plan and the progress ratio deliberately fail in opposite directions.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f697d630d
ℹ️ 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".
| # fallback, which is what main does today. | ||
| # terminal (_get_model_file raises rather than falling back to the hub) and a sharded load | ||
| # raises per missing shard, so a partial snapshot would drop a build the hub id completes. | ||
| # Off the hub id a base only the other root holds costs a re-download, as main does today. |
There was a problem hiding this comment.
Preserve the auth-failure branch in this comment
When a gated base exists only under the import-time cache root and its token is missing or expired, this live-root-pinned from_pretrained call cannot re-download the transformer: it raises a 401, and the caller falls back to the GGUF build unless an active LoRA forbids that fallback. Saying the Hub ID simply “costs a re-download” removes this important failure mode and misdescribes the behavior this deliberately indirect load path preserves; retain the previous re-download-or-401 distinction.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in abc895f. The trim collapsed two distinct outcomes into one: off the hub id a base only the other cache root holds costs a re-download, and separately 401s into the GGUF fallback when the base is gated and the token cannot read it. Restored the original wording verbatim, and the parallel comment in test_the_dense_builder_reads_transformer_from_the_hub_id_not_the_staged_snapshot keeps the same pair.
| """The repo id AND its licence page: the Hub's 401/403 names neither, and the base comes from a | ||
| card tag, so the user never saw which repo it is.""" |
There was a problem hiding this comment.
Keep the missing-repo attribution on the worker
A Hugging Face Hub 401/403 exception normally includes the requested resolve URL, which identifies the repository; it is the worker/UI error surfaced before this preflight that reduces the failure to a bare token message and leaves the card-derived base unidentified. Replacing “worker's” with “Hub's” therefore makes the helper's rationale factually incorrect and can mislead future work on which layer needs the richer error, so retain the worker attribution (the Hub response still does not provide the licence-page guidance).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in abc895f. A Hub 401/403 does name the repo: huggingface_hub raises it off the resolve URL, so the message carries the repo id in the URL it failed on. It is the worker layer that reduces that to a bare token message, which is why the repo id and licence URL have to be re-added here. Reverted to "the worker's 401/403".
Restore the second failure mode on the dense-transformer hub id (a re-download or a 401 into the GGUF fallback), the worker attribution in the repo-access message, the blob-reuse and failed-HEAD guarantees behind the other-root reuse, the needless re-download of every moved asset, and the reachability notes for the unresolvable-home and renamed-repo branches.
|
Both review items were right, and I took them as a signal to re-audit the whole trim for the same failure mode: a shortened comment that quietly drops a concrete fact. Five more cases, all restored in abc895f, all verified against huggingface_hub 0.36.2 and CPython 3.13 rather than from memory.
I also pulled the qualifier back off the 2664 fix so it restores the original claim exactly instead of narrowing the 401 to a missing token; gating, not token absence, is what produces it. Everything else I checked reads as a legitimate tightening. The dropped AST gate is green across all 10 files against the pre-trim base: code and docstring-stripped ASTs identical, so this stays comment-only. Targeted suites pass, 411 in the five diffusion modules plus 172 in hub/tests. |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abc895f3d9
ℹ️ 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".
| # re-download instead, or 401s into the GGUF fallback, which is what main does today. | ||
| # directory as terminal (_get_model_file raises instead of falling back to the hub) and a | ||
| # sharded load raises per missing shard, so a partial snapshot -- what a cancelled prefetch | ||
| # leaves -- would turn a working load into a hard failure. The hub id re-downloads instead. |
There was a problem hiding this comment.
Preserve the auth-failure branch in the test rationale
When the staged base exists only under the import-time cache root and its gated-repo token is missing or expired, this live-root-pinned Hub-ID load does not re-download: from_pretrained raises a 401 and load_pipeline falls back to the GGUF build unless an active LoRA forbids that fallback. Fresh evidence in the final tree is that the production comment at _load_dense_quant_pipeline now restores this distinction, while this changed test rationale still claims the Hub ID only re-downloads; retain both outcomes here so the test does not document the wrong behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in a80e5fe: the test rationale now keeps both outcomes again, matching the _load_dense_quant_pipeline docstring. A gated base without a usable token raises out of from_pretrained (huggingface_hub hf_raise_for_status turns the 401/403 into RepositoryNotFoundError/GatedRepoError), load_pipeline catches it and builds the GGUF pipeline, and only a nonzero baked LoRA turns that into a hard failure.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
Comment-only follow-up to #7870, now that it has landed. Ten files, 311 insertions / 437 deletions, net -126 lines of comment text. No code changes.
What was cut
_assert_base_repo_accessible,_cache_bytes,_union_over_cached_revs,_hub_cache_repo_dirs,_download_checkpoint_name,preflight_base_accesson both backends, andhf_hub_download_with_xet_fallback.UNSLOTH_DIFFUSION_NO_MIRRORpreamble intest_diffusion_gated_base.py, collapsed to one line each.What was deliberately kept
Every comment recording a non-obvious fact survives, just shorter:
responsea required keyword-only argument and dereferences it unguarded, which is why the test builds the error through__new__hf_raise_for_statusfolds an unauthenticated 401 intoRepositoryNotFoundErrorbecause "401 is misleading"expanduser()raisesRuntimeError, notOSError, when it cannot resolve a home directoryblobs/is append-only across republished revisions_cache_bytesscopes torefs/mainso the ratio cannot over-count a stale copy into a false "finalizing"Verification
comment_tools.py check --changed --strip-docstrings: 10/10 OK, comments and docstrings only, no code touched. Re-run against currentmain, not just the original branch.test_diffusion_backend,test_diffusion_gated_base,test_diffusion_routes,test_sd_cpp_backend,test_diffusion_prequant: 411 passedhub/tests/as a separate invocation: 172 passedscripts/run_ruff_format.pyRebased onto
mainrather than pushed to the old branch: #7870 was squash-merged, so its head is not an ancestor ofmainand a PR from that branch would have re-shown the entire original diff.