From f75fd97c08cb3504143e87e8815f544363baf5f1 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Mon, 26 May 2025 23:08:49 +0100 Subject: [PATCH] HuggingFace uploads are missing access token Fixes #111 --- changelog_entry.yaml | 4 ++++ policyengine_uk_data/utils/data_upload.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..7c280180b 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Added missing HF token diff --git a/policyengine_uk_data/utils/data_upload.py b/policyengine_uk_data/utils/data_upload.py index 42d0fec24..89445ad96 100644 --- a/policyengine_uk_data/utils/data_upload.py +++ b/policyengine_uk_data/utils/data_upload.py @@ -6,6 +6,7 @@ from importlib import metadata import google.auth import logging +import os def upload_data_files( @@ -42,6 +43,9 @@ def upload_files_to_hf( Upload files to Hugging Face repository and tag the commit with the version. """ api = HfApi() + token = os.environ.get( + "HUGGING_FACE_TOKEN", + ) hf_operations = [] for file_path in files: @@ -55,6 +59,7 @@ def upload_files_to_hf( ) ) commit_info = api.create_commit( + token=token, repo_id=hf_repo_name, operations=hf_operations, repo_type=hf_repo_type, @@ -64,6 +69,7 @@ def upload_files_to_hf( # Tag commit with version api.create_tag( + token=token, repo_id=hf_repo_name, tag=version, revision=commit_info.oid,