Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,7 @@ def rename_files_with_six_digit_code(file_path):
|
|
| 67 |
return None
|
| 68 |
|
| 69 |
|
| 70 |
-
def download_files_from_huggingface(repo_id, repo_type, max_retries=
|
| 71 |
file_list = list_repo_files(repo_id=repo_id, repo_type=repo_type)
|
| 72 |
for file in file_list:
|
| 73 |
relative_path = os.path.dirname(file)
|
|
@@ -91,12 +91,18 @@ def download_files_from_huggingface(repo_id, repo_type, max_retries=3):
|
|
| 91 |
break
|
| 92 |
except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError, LocalEntryNotFoundError) as e:
|
| 93 |
if attempt < max_retries - 1:
|
| 94 |
-
wait_time = (attempt + 1)*
|
| 95 |
print(f"Download failed, retrying in {wait_time} seconds")
|
| 96 |
time.sleep(wait_time)
|
| 97 |
except FileExistsError:
|
| 98 |
print(f"{file} Exists")
|
| 99 |
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
download_files_from_huggingface(repo_id, 'model')
|
| 102 |
|
|
|
|
| 67 |
return None
|
| 68 |
|
| 69 |
|
| 70 |
+
def download_files_from_huggingface(repo_id, repo_type, max_retries=10):
|
| 71 |
file_list = list_repo_files(repo_id=repo_id, repo_type=repo_type)
|
| 72 |
for file in file_list:
|
| 73 |
relative_path = os.path.dirname(file)
|
|
|
|
| 91 |
break
|
| 92 |
except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError, LocalEntryNotFoundError) as e:
|
| 93 |
if attempt < max_retries - 1:
|
| 94 |
+
wait_time = (attempt + 1)*40
|
| 95 |
print(f"Download failed, retrying in {wait_time} seconds")
|
| 96 |
time.sleep(wait_time)
|
| 97 |
except FileExistsError:
|
| 98 |
print(f"{file} Exists")
|
| 99 |
break
|
| 100 |
+
except Exception as e:
|
| 101 |
+
if attempt < max_retries - 1:
|
| 102 |
+
wait_time = (attempt + 1)*100
|
| 103 |
+
print(f"Unknown exception, retrying in {wait_time} seconds")
|
| 104 |
+
time.sleep(wait_time)
|
| 105 |
+
|
| 106 |
|
| 107 |
download_files_from_huggingface(repo_id, 'model')
|
| 108 |
|