[Download] A `ResolvedRevision` only pins the repo it was resolved for (#4767)
* [Download] A `ResolvedRevision` only pins the repo it was resolved for
A commit hash means nothing outside of the repo it comes from, but a
`ResolvedRevision` used to be trusted by any repo: `resolve_revision`
returned it untouched, and the download helpers used its commit hash
whatever repo they were fetching from. A library resolving a revision for
one repo and reusing it for another (a base model and its adapter, a
pipeline component in its own repo, ...) would then request a commit that
does not exist there.
Instances now remember the repo (id + type) they were resolved against,
and only pin that one. Anywhere else, the revision initially requested is
used instead, and resolved again if needed.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* [Download] Scope the fix to resolve_revision: drop _commit_hash_for
Download helpers trust the passed `ResolvedRevision` again (`revision.resolved`
as before). The only behavior change is in `HfApi.resolve_revision`: a revision
resolved for another repo is resolved again for the requested one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>