Skip to content

Commit 78acda9

Browse files
authored
Remove deprecated HfFolder (#701)
Remove deprecated HfFolder
1 parent ba161f5 commit 78acda9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/evaluate/utils/file_utils.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,10 @@ def get_authentication_headers_for_url(url: str, token: Optional[Union[str, bool
226226
"""Handle the HF authentication"""
227227
headers = {}
228228
if url.startswith(config.HF_ENDPOINT):
229-
if token is False:
230-
token = None
231-
elif isinstance(token, str):
232-
token = token
233-
else:
234-
from huggingface_hub import hf_api
229+
from huggingface_hub.utils import build_hf_headers
230+
231+
headers = build_hf_headers(token=token, library_name="evaluate", library_version=__version__)
235232

236-
token = hf_api.HfFolder.get_token()
237-
if token:
238-
headers["authorization"] = f"Bearer {token}"
239233
return headers
240234

241235

0 commit comments

Comments
 (0)