Repository navigation
Description
A load with subfolder= selects one checkpoint, not a repository from which each consumer picks a checkpoint. The individual bugs below are fixed. The remaining design problem is that passing the repository root instead of the selected directory is still a valid call at each boundary.
Evidence. #5461 passed the selected directory to wrapper-owned consumers (processor, packed-embedding probe, re-save). #5476 had to make the same choice separately for TT block-float detection and construction. #5494 fixed the earlier dense/quantized dispatch decision for legacy sidecars, including revision and offline lookup. A test of weight loading or path joining alone cannot constrain these siblings.
Proposed contract. At public load entry, create one immutable selection: source ID or local root, normalized subfolder, requested revision and lookup policy. Expose two explicit views: (1) original source plus selection kwargs for Hub/Transformers calls, and (2) the selected local directory, once materialized, for filesystem-only consumers. Never pass a narrowed path and the subfolder, or fall back to the parent/default revision for a missing file. Probing a sidecar must not require downloading the whole model; offline probes must not list a remote repo. Keep transport credentials out of persisted state.
Bounded migration. Start with the existing get_config_selection_kwargs and resolve_checkpoint_subfolder helpers; retain their validation and current public signatures. Move auto-dispatch and the TT detector/builder onto the two views first. Then pass the same selection to config/tokenizer, processor, weight/embedding readers and the wrapper that reopens the source on save. No checkpoint format change.
Acceptance tests. Extend the subfolder suite with one shared fixture: valid but distinguishable artifacts at root and child. Assert direct-child and root-plus-subfolder loads select identical backend, processor marker and tensors, including after re-save/reload. Put a legacy sidecar only at the root, then only at the child; verify opposite dispatch decisions. Add a pinned-revision Hub double and an offline cache hit/miss with remote listing forbidden. Preserve root-only loads and the existing subfolder containment checks.
Activity
refactor(loader): one immutable checkpoint selection for every consum…
refactor(loader): one immutable checkpoint selection for every consum…