Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add files_metadata option to repo_info #951

Merged
merged 14 commits into from
Aug 9, 2022

Conversation

SBrandeis
Copy link
Contributor

Nice to have in #943

cc @mariosasko @lhoestq
cc @huggingface/moon-landing-back

This PR adds a new files_metadata flag to HfApi.repo_info.
When set to True, this flag fetches additional metadata in{Model|Dataset|Space}Info.siblings:

>>> from huggingface_hub import model_info
>>> model = model_info("bert-base-uncased", files_metadata=True)
>>> model.siblings
# [
#     RepoFile(rfilename='.gitattributes', size='437', blob_id='4d564b466df31bf165495398c0d8ef51ddd2ee99', lfs='None'),
#     RepoFile(rfilename='LICENSE', size='11356', blob_id='f49a4e16e68b128803cc2dcea614603632b04eac', lfs='None'),
#     [...]
#     RepoFile(rfilename='flax_model.msgpack', size='438064459', blob_id='5dfe9adac0748dcecbb14ab068f6a9406d7348da', lfs='{'sha256': 'ea201fabe466ef7182f1f687fb5be4b62a73d3a78883f11264ff7f682cdb54bf', 'size': 438064459}'),
#     RepoFile(rfilename='pytorch_model.bin', size='440473133', blob_id='ba5d19791be1dd7992e33bd61f20207b0f7f50a5', lfs='{'sha256': '097417381d6c7230bd9e3557456d726de6e83245ec8b24f529f60198a67b203a', 'size': 440473133}'),
# ]

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 21, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks @SBrandeis! Only left a comment.

- Links to RepoInfo & RepoFile objects in docstring
- Fix some typos / incorrectness
Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this PR! Very cool!

src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
tests/test_hf_api.py Show resolved Hide resolved
SBrandeis and others added 4 commits July 26, 2022 13:41
Co-authored-by: Omar Sanseviero <osanseviero@gmail.com>
Co-authored-by: Omar Sanseviero <osanseviero@gmail.com>
@SBrandeis SBrandeis requested a review from Wauplin August 4, 2022 15:44
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SBrandeis I approved with optional suggestions. It is more about sharing a hint about how I would I done things 🙂

src/huggingface_hub/hf_api.py Outdated Show resolved Hide resolved
src/huggingface_hub/hf_api.py Show resolved Hide resolved
tests/test_hf_api.py Outdated Show resolved Hide resolved
tests/test_hf_api.py Outdated Show resolved Hide resolved
tests/test_hf_api.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants