fix: hf.revision property to pin HuggingFace Hub reads#3609
Draft
kszucs wants to merge 1 commit into
Draft
Conversation
huggingface_hub.HfFileSystem resolves revision per call rather than as a filesystem-wide default, so hf.revision is threaded through as a read-time kwarg on FsspecInputFile. Writes and deletes always target the repository's default branch, since a pinned revision can be an immutable tag or commit.
hf.revision property to pin HuggingFace Hub reads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
HuggingFace Hub (
hf://) storage support already works viafsspec'sHfFileSystem, but has no way to pin reads to a specific revision (branch/tag/commit) for reproducibility, unlike iceberg-rust'sHF_REVISION.HfFileSystemresolvesrevisionper call rather than as a filesystem-wide default, sohf.revisionis threaded through as a read-time kwarg onFsspecInputFile. Writes and deletes intentionally always target the repository's default branch, since a pinned revision can be an immutable tag or commit and isn't a valid write target.Are these changes tested?
Yes: unit tests covering revision forwarding on reads (
len(),.exists(),.open()), confirming writes don't receive the revision kwarg, the no-revision-set default, and non-hfschemes being unaffected.Are there any user-facing changes?
Yes: new
hf.revisiontable/catalog property, documented inconfiguration.md.