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

FIX user agent not passed in snapshot_download #1478

Merged
merged 1 commit into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/huggingface_hub/_snapshot_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,10 @@ def snapshot_download(
)

# if we have internet connection we retrieve the correct folder name from the huggingface api
_api = HfApi()
repo_info = _api.repo_info(
repo_id=repo_id,
repo_type=repo_type,
revision=revision,
token=token,
)
api = HfApi(library_name=library_name, library_version=library_version, user_agent=user_agent)
repo_info = api.repo_info(repo_id=repo_id, repo_type=repo_type, revision=revision, token=token)
assert repo_info.sha is not None, "Repo info returned from server must have a revision sha."

filtered_repo_files = list(
filter_repo_objects(
items=[f.rfilename for f in repo_info.siblings],
Expand Down