Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -157,8 +157,11 @@ class S3DirectStream:
|
|
157 |
if file_info.rfilename.endswith(('.bin', '.safetensors', 'config.json', 'tokenizer.json')):
|
158 |
file_url = api.download_file(model_prefix, file_info.rfilename)
|
159 |
s3_key = f"{model_prefix}/{file_info.rfilename}"
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
162 |
|
163 |
logger.info(f"Finished downloading and uploading model files for {model_prefix}.")
|
164 |
|
@@ -171,7 +174,7 @@ class S3DirectStream:
|
|
171 |
|
172 |
|
173 |
def _get_model_files(self, model_prefix, revision="main"):
|
174 |
-
index_url = f"https://huggingface.co/{model_prefix}/
|
175 |
try:
|
176 |
index_response = requests.get(index_url)
|
177 |
index_response.raise_for_status()
|
|
|
157 |
if file_info.rfilename.endswith(('.bin', '.safetensors', 'config.json', 'tokenizer.json')):
|
158 |
file_url = api.download_file(model_prefix, file_info.rfilename)
|
159 |
s3_key = f"{model_prefix}/{file_info.rfilename}"
|
160 |
+
try:
|
161 |
+
self.download_and_upload_to_s3_url(file_url, s3_key)
|
162 |
+
logger.info(f"Downloaded and uploaded {s3_key}")
|
163 |
+
except Exception as e:
|
164 |
+
logger.exception(f"Error downloading/uploading {s3_key}: {e}")
|
165 |
|
166 |
logger.info(f"Finished downloading and uploading model files for {model_prefix}.")
|
167 |
|
|
|
174 |
|
175 |
|
176 |
def _get_model_files(self, model_prefix, revision="main"):
|
177 |
+
index_url = f"https://huggingface.co/{model_prefix}/resolve/{revision}/"
|
178 |
try:
|
179 |
index_response = requests.get(index_url)
|
180 |
index_response.raise_for_status()
|