Use get_token instead of deprecated HFFolder.get_token#654
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary of ChangesHello @wirthual, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the code to be compatible with huggingface_hub version 1.0 and later. The changes correctly replace the deprecated HfFolder class and its get_token method with the recommended get_token function. This is done in infinity_emb/transformer/utils_optimum.py for fetching model files from the Hugging Face Hub. The changes are correct and necessary for the library to function with newer versions of its dependency. The implementation is straightforward and I see no issues with it.
Greptile OverviewGreptile SummaryMigrates authentication token retrieval from deprecated Key changes:
Important note: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application
participant Utils as utils_optimum._list_all_repo_files
participant HF as huggingface_hub
participant API as HfApi
App->>Utils: _list_all_repo_files(model_name_or_path, use_auth_token)
alt use_auth_token is bool
Utils->>HF: get_token()
Note over HF: Retrieves token from<br/>HF token storage
HF-->>Utils: token or None
else use_auth_token is string
Note over Utils: Use provided token directly
end
Utils->>API: list_repo_files(model_name_or_path, revision, token)
API-->>Utils: list of file paths
Utils-->>App: List[Path]
|
get_token instead of deprecated HFFolder.get_token
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
=======================================
Coverage 79.91% 79.91%
=======================================
Files 43 43
Lines 3495 3495
=======================================
Hits 2793 2793
Misses 702 702 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Only merge after updatinghuggingface_hub > 1get tokenis already available in0.34.1. See hereTested locally:
Should address #653