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 token attribute to HfApi #1116

Merged
merged 14 commits into from
Oct 18, 2022
Merged

Add token attribute to HfApi #1116

merged 14 commits into from
Oct 18, 2022

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Oct 14, 2022

Fix #1104 and #796.

A token attribute is now added to HfApi so that it's sent in all API calls but not persisted on the machine.

from huggingface_hub import HfApi

hf_api = HfApi(
   endpoint="https://huggingface.co", # Can be a Private Hub endpoint.
   token="hf_xxx", # Token is not persisted on the machine.
)
 models = hf_api.list_models() # private models as well !

TODOs:

  • implement attribute
  • adapt test suite 🎉
  • documentation

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 14, 2022

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

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Base: 84.20% // Head: 84.22% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (f6b4de9) compared to base (9169c09).
Patch coverage: 95.23% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1116      +/-   ##
==========================================
+ Coverage   84.20%   84.22%   +0.01%     
==========================================
  Files          40       40              
  Lines        4007     4012       +5     
==========================================
+ Hits         3374     3379       +5     
  Misses        633      633              
Impacted Files Coverage Δ
src/huggingface_hub/hf_api.py 87.40% <95.23%> (+0.08%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Nice!

tests/test_cache_layout.py Outdated Show resolved Hide resolved
@Wauplin Wauplin merged commit da33139 into main Oct 18, 2022
@Wauplin Wauplin deleted the 1104-add-token-attribute-to-hfapi branch October 18, 2022 15:47
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.

Add a token attribute to HfApi
3 participants