Spaces:
Sleeping
Sleeping
zhimin-z
commited on
Commit
·
c109720
1
Parent(s):
ddf12d3
refine to 5 retry
Browse files
app.py
CHANGED
|
@@ -47,12 +47,12 @@ def is_rate_limit_error(e):
|
|
| 47 |
@backoff.on_exception(
|
| 48 |
backoff.expo,
|
| 49 |
HfHubHTTPError,
|
| 50 |
-
max_tries=
|
| 51 |
base=300,
|
| 52 |
max_value=3600,
|
| 53 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 54 |
on_backoff=lambda details: print(
|
| 55 |
-
f"Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 56 |
)
|
| 57 |
)
|
| 58 |
def list_repo_files_with_backoff(api, **kwargs):
|
|
@@ -63,12 +63,12 @@ def list_repo_files_with_backoff(api, **kwargs):
|
|
| 63 |
@backoff.on_exception(
|
| 64 |
backoff.expo,
|
| 65 |
HfHubHTTPError,
|
| 66 |
-
max_tries=
|
| 67 |
base=300,
|
| 68 |
max_value=3600,
|
| 69 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 70 |
on_backoff=lambda details: print(
|
| 71 |
-
f"Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 72 |
)
|
| 73 |
)
|
| 74 |
def hf_hub_download_with_backoff(**kwargs):
|
|
|
|
| 47 |
@backoff.on_exception(
|
| 48 |
backoff.expo,
|
| 49 |
HfHubHTTPError,
|
| 50 |
+
max_tries=5,
|
| 51 |
base=300,
|
| 52 |
max_value=3600,
|
| 53 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 54 |
on_backoff=lambda details: print(
|
| 55 |
+
f"Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 56 |
)
|
| 57 |
)
|
| 58 |
def list_repo_files_with_backoff(api, **kwargs):
|
|
|
|
| 63 |
@backoff.on_exception(
|
| 64 |
backoff.expo,
|
| 65 |
HfHubHTTPError,
|
| 66 |
+
max_tries=5,
|
| 67 |
base=300,
|
| 68 |
max_value=3600,
|
| 69 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 70 |
on_backoff=lambda details: print(
|
| 71 |
+
f"Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 72 |
)
|
| 73 |
)
|
| 74 |
def hf_hub_download_with_backoff(**kwargs):
|
msr.py
CHANGED
|
@@ -204,12 +204,12 @@ def is_retryable_error(e):
|
|
| 204 |
@backoff.on_exception(
|
| 205 |
backoff.expo,
|
| 206 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 207 |
-
max_tries=
|
| 208 |
base=300,
|
| 209 |
max_value=3600,
|
| 210 |
giveup=lambda e: not is_retryable_error(e),
|
| 211 |
on_backoff=lambda details: print(
|
| 212 |
-
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 213 |
)
|
| 214 |
)
|
| 215 |
def list_repo_files_with_backoff(api, **kwargs):
|
|
@@ -220,12 +220,12 @@ def list_repo_files_with_backoff(api, **kwargs):
|
|
| 220 |
@backoff.on_exception(
|
| 221 |
backoff.expo,
|
| 222 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 223 |
-
max_tries=
|
| 224 |
base=300,
|
| 225 |
max_value=3600,
|
| 226 |
giveup=lambda e: not is_retryable_error(e),
|
| 227 |
on_backoff=lambda details: print(
|
| 228 |
-
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 229 |
)
|
| 230 |
)
|
| 231 |
def hf_hub_download_with_backoff(**kwargs):
|
|
@@ -236,12 +236,12 @@ def hf_hub_download_with_backoff(**kwargs):
|
|
| 236 |
@backoff.on_exception(
|
| 237 |
backoff.expo,
|
| 238 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 239 |
-
max_tries=
|
| 240 |
base=300,
|
| 241 |
max_value=3600,
|
| 242 |
giveup=lambda e: not is_retryable_error(e),
|
| 243 |
on_backoff=lambda details: print(
|
| 244 |
-
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 245 |
)
|
| 246 |
)
|
| 247 |
def upload_file_with_backoff(api, **kwargs):
|
|
@@ -252,12 +252,12 @@ def upload_file_with_backoff(api, **kwargs):
|
|
| 252 |
@backoff.on_exception(
|
| 253 |
backoff.expo,
|
| 254 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 255 |
-
max_tries=
|
| 256 |
base=300,
|
| 257 |
max_value=3600,
|
| 258 |
giveup=lambda e: not is_retryable_error(e),
|
| 259 |
on_backoff=lambda details: print(
|
| 260 |
-
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/
|
| 261 |
)
|
| 262 |
)
|
| 263 |
def upload_folder_with_backoff(api, **kwargs):
|
|
|
|
| 204 |
@backoff.on_exception(
|
| 205 |
backoff.expo,
|
| 206 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 207 |
+
max_tries=5,
|
| 208 |
base=300,
|
| 209 |
max_value=3600,
|
| 210 |
giveup=lambda e: not is_retryable_error(e),
|
| 211 |
on_backoff=lambda details: print(
|
| 212 |
+
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 213 |
)
|
| 214 |
)
|
| 215 |
def list_repo_files_with_backoff(api, **kwargs):
|
|
|
|
| 220 |
@backoff.on_exception(
|
| 221 |
backoff.expo,
|
| 222 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 223 |
+
max_tries=5,
|
| 224 |
base=300,
|
| 225 |
max_value=3600,
|
| 226 |
giveup=lambda e: not is_retryable_error(e),
|
| 227 |
on_backoff=lambda details: print(
|
| 228 |
+
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 229 |
)
|
| 230 |
)
|
| 231 |
def hf_hub_download_with_backoff(**kwargs):
|
|
|
|
| 236 |
@backoff.on_exception(
|
| 237 |
backoff.expo,
|
| 238 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 239 |
+
max_tries=5,
|
| 240 |
base=300,
|
| 241 |
max_value=3600,
|
| 242 |
giveup=lambda e: not is_retryable_error(e),
|
| 243 |
on_backoff=lambda details: print(
|
| 244 |
+
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 245 |
)
|
| 246 |
)
|
| 247 |
def upload_file_with_backoff(api, **kwargs):
|
|
|
|
| 252 |
@backoff.on_exception(
|
| 253 |
backoff.expo,
|
| 254 |
(HfHubHTTPError, requests.exceptions.Timeout, requests.exceptions.RequestException, Exception),
|
| 255 |
+
max_tries=5,
|
| 256 |
base=300,
|
| 257 |
max_value=3600,
|
| 258 |
giveup=lambda e: not is_retryable_error(e),
|
| 259 |
on_backoff=lambda details: print(
|
| 260 |
+
f" {details['exception']} error. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/5..."
|
| 261 |
)
|
| 262 |
)
|
| 263 |
def upload_folder_with_backoff(api, **kwargs):
|