Skip to content

Commit 547b380

Browse files
committed
restore download_file_with_auth
1 parent 4e0f769 commit 547b380

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

convert_hf_to_gguf_update.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#
2323
# TODO: generate tokenizer tests for llama.cpp
2424
#
25-
import subprocess
26-
import importlib.util
2725
import logging
2826
import os
2927
import pathlib
@@ -142,23 +140,12 @@ def fugashi_check():
142140

143141
def download_file_with_auth(url, token, save_path):
144142
headers = {"Authorization": f"Bearer {token}"}
145-
try:
146-
response = sess.get(url, headers=headers)
147-
response.raise_for_status()
148-
149-
os.makedirs(os.path.dirname(save_path), exist_ok=True)
150-
with open(save_path, 'wb') as downloaded_file:
151-
downloaded_file.write(response.content)
152-
logger.info(f"File {save_path} downloaded successfully")
153-
except requests.HTTPError as e:
154-
if e.response.status_code == 404:
155-
logger.warning(f"URL not found: {url}")
156-
else:
157-
logger.error(f"HTTP error occurred when downloading {url}: {e}")
158-
except requests.ConnectionError:
159-
logger.error(f"Connection error occurred when downloading {url}")
160-
except Exception as e:
161-
logger.error(f"Unexpected error occurred when downloading {url}: {e}")
143+
response = sess.get(url, headers=headers)
144+
response.raise_for_status()
145+
os.makedirs(os.path.dirname(save_path), exist_ok=True)
146+
with open(save_path, 'wb') as downloaded_file:
147+
downloaded_file.write(response.content)
148+
logger.info(f"File {save_path} downloaded successfully")
162149

163150

164151
def download_model(model):

0 commit comments

Comments
 (0)