-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Remove deprecated HfFolder #6512
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening a PR. Actually I think you can even get rid of huggingface_hub.get_token
if you want (see comment).
src/datasets/utils/file_utils.py
Outdated
if config.HF_HUB_VERSION > version.parse("0.20.0"): | ||
token = huggingface_hub.get_token() | ||
else: | ||
token = huggingface_hub.HfFolder.get_token() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the whole get_authentication_headers_for_url
can be replaced by huggingface_hub.utils.build_hf_headers
which returns a dictionary with authorization + user_agent. You can then override some fields if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
src/datasets/utils/file_utils.py
Outdated
if config.HF_HUB_VERSION >= version.parse("0.20.0"): | ||
return huggingface_hub.utils.build_hf_headers( | ||
token=token, library_name="datasets", library_version=__version__ | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_hf_headers
is available since Sept 2022 (see huggingface/huggingface_hub#1064) so no need to check HF_HUB_VERSION
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, therefore I got rid of HfFolder completely :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for making the changes @lhoestq!
Show benchmarksPyArrow==8.0.0 Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
|
...and use
huggingface_hub.get_token()
instead