Send headers when converting safetensors (#30144)

Co-authored-by: Wauplin <lucainp@gmail.com>
This commit is contained in:
Yih-Dar 2024-04-09 17:03:36 +02:00 committed by GitHub
parent 08a194fcd6
commit 6487e9b370
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@ from typing import Optional
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__)
@ -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: