Skip to content

Commit

Permalink
Send headers when converting safetensors (#30144)
Browse files Browse the repository at this point in the history
Co-authored-by: Wauplin <lucainp@gmail.com>
  • Loading branch information
2 people authored and ArthurZucker committed Apr 22, 2024
1 parent 3c95f38 commit ff87fca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transformers/safetensors_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import requests
from huggingface_hub import Discussion, HfApi, get_repo_discussions

from .utils import cached_file, logging
from .utils import cached_file, http_user_agent, logging


logger = logging.get_logger(__name__)
Expand Down Expand Up @@ -86,7 +86,7 @@ def get_conversion_pr_reference(api: HfApi, model_id: str, **kwargs):

def auto_conversion(pretrained_model_name_or_path: str, ignore_errors_during_conversion=False, **cached_file_kwargs):
try:
api = HfApi(token=cached_file_kwargs.get("token"))
api = HfApi(token=cached_file_kwargs.get("token"), headers=http_user_agent())
sha = get_conversion_pr_reference(api, pretrained_model_name_or_path, **cached_file_kwargs)

if sha is None:
Expand Down

0 comments on commit ff87fca

Please sign in to comment.