Skip to content

Design: give checkpoint detection, loading and re-save one source selection #5586

Done

Description

@devin-ai-integration

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.

@Qubitium

Activity

  1. added
    scanned
    safe
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    safescanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions