From a83fbc842e3ebd493fc9a43116bd0a5684fb027e Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Fri, 29 Nov 2024 14:06:21 +0000 Subject: [PATCH] Don't re-login every time --- policyengine_core/data/dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/policyengine_core/data/dataset.py b/policyengine_core/data/dataset.py index 9f3b1848..d648417e 100644 --- a/policyengine_core/data/dataset.py +++ b/policyengine_core/data/dataset.py @@ -461,7 +461,6 @@ def upload_to_huggingface(self, owner_name: str, model_name: str): token = os.environ.get( "HUGGING_FACE_TOKEN", ) - login(token=token) api = HfApi() api.upload_file( @@ -469,6 +468,7 @@ def upload_to_huggingface(self, owner_name: str, model_name: str): path_in_repo=self.file_path.name, repo_id=f"{owner_name}/{model_name}", repo_type="model", + token=token, ) def download_from_huggingface( @@ -483,11 +483,11 @@ def download_from_huggingface( token = os.environ.get( "HUGGING_FACE_TOKEN", ) - login(token=token) hf_hub_download( repo_id=f"{owner_name}/{model_name}", repo_type="model", path=self.file_path, revision=version, + token=token, )