From 8db7e857b1690ea38733ce0fde940aafb0318aea Mon Sep 17 00:00:00 2001 From: Ahmad Fahadh Ilyas <37577369+fahadh4ilyas@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:48:08 +0700 Subject: [PATCH] Add token authorization for downloading model (#3067) --- download-model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/download-model.py b/download-model.py index d6b2ebf..34986c7 100644 --- a/download-model.py +++ b/download-model.py @@ -30,6 +30,8 @@ class ModelDownloader: self.s.mount('https://huggingface.co', HTTPAdapter(max_retries=max_retries)) if os.getenv('HF_USER') is not None and os.getenv('HF_PASS') is not None: self.s.auth = (os.getenv('HF_USER'), os.getenv('HF_PASS')) + if os.getenv('HF_TOKEN') is not None: + self.s.headers = {'authorization': f'Bearer {os.getenv("HF_TOKEN")}'} def sanitize_model_and_branch_names(self, model, branch): if model[-1] == '/':