Skip to content

Commit

Permalink
Fix missing HFH token param from preupload_lfs_files (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoinkinen authored Oct 2, 2024
1 parent 4b01501 commit 3a5c12e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion annif/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def run_upload(

fobjs, operations = [], []
try:
fobjs, operations = hfh_util.prepare_commits(projects, repo_id)
fobjs, operations = hfh_util.prepare_commits(projects, repo_id, token)
api = HfApi()
api.create_commit(
repo_id=repo_id,
Expand Down
6 changes: 4 additions & 2 deletions annif/hfh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def get_matching_projects(pattern: str) -> list[AnnifProject]:
]


def prepare_commits(projects: list[AnnifProject], repo_id: str) -> tuple[list, list]:
def prepare_commits(
projects: list[AnnifProject], repo_id: str, token: str
) -> tuple[list, list]:
"""Prepare and pre-upload data and config commit operations for projects to a
Hugging Face Hub repository."""
from huggingface_hub import preupload_lfs_files
Expand All @@ -76,7 +78,7 @@ def prepare_commits(projects: list[AnnifProject], repo_id: str) -> tuple[list, l

for data_dir in all_dirs:
fobj, operation = _prepare_datadir_commit(data_dir)
preupload_lfs_files(repo_id, additions=[operation])
preupload_lfs_files(repo_id, additions=[operation], token=token)
fobjs.append(fobj)
operations.append(operation)

Expand Down

0 comments on commit 3a5c12e

Please sign in to comment.