Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions download-model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import tqdm
from requests.adapters import HTTPAdapter
from tqdm.contrib.concurrent import thread_map
from huggingface_hub import get_token

base = "https://huggingface.co"

Expand All @@ -32,8 +33,8 @@ def __init__(self, max_retries=5):
self.session.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.session.auth = (os.getenv('HF_USER'), os.getenv('HF_PASS'))
if os.getenv('HF_TOKEN') is not None:
self.session.headers = {'authorization': f'Bearer {os.getenv("HF_TOKEN")}'}
if get_token() is not None:
self.session.headers = {'authorization': f'Bearer {get_token()}'}

def sanitize_model_and_branch_names(self, model, branch):
if model[-1] == '/':
Expand Down