From 6f29bab177051d3fb4c0046bba0b714c3fbb49fb Mon Sep 17 00:00:00 2001 From: Wauplin Date: Thu, 18 Sep 2025 12:15:19 +0200 Subject: [PATCH] Remove deprecated HfFolder --- src/evaluate/utils/file_utils.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/evaluate/utils/file_utils.py b/src/evaluate/utils/file_utils.py index 53bbf1c5..4c278905 100644 --- a/src/evaluate/utils/file_utils.py +++ b/src/evaluate/utils/file_utils.py @@ -226,16 +226,10 @@ def get_authentication_headers_for_url(url: str, token: Optional[Union[str, bool """Handle the HF authentication""" headers = {} if url.startswith(config.HF_ENDPOINT): - if token is False: - token = None - elif isinstance(token, str): - token = token - else: - from huggingface_hub import hf_api + from huggingface_hub.utils import build_hf_headers + + headers = build_hf_headers(token=token, library_name="evaluate", library_version=__version__) - token = hf_api.HfFolder.get_token() - if token: - headers["authorization"] = f"Bearer {token}" return headers