add time
Browse files
app.py
CHANGED
|
@@ -53,8 +53,10 @@ def is_rate_limit_error(e):
|
|
| 53 |
HfHubHTTPError,
|
| 54 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 55 |
max_tries=8,
|
|
|
|
|
|
|
| 56 |
jitter=backoff.full_jitter,
|
| 57 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 58 |
)
|
| 59 |
def upload_large_folder_with_backoff(api, **kwargs):
|
| 60 |
"""Upload large folder with exponential backoff on rate limit errors."""
|
|
@@ -65,8 +67,10 @@ def upload_large_folder_with_backoff(api, **kwargs):
|
|
| 65 |
HfHubHTTPError,
|
| 66 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 67 |
max_tries=8,
|
|
|
|
|
|
|
| 68 |
jitter=backoff.full_jitter,
|
| 69 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 70 |
)
|
| 71 |
def list_repo_files_with_backoff(api, **kwargs):
|
| 72 |
"""List repo files with exponential backoff on rate limit errors."""
|
|
@@ -77,8 +81,10 @@ def list_repo_files_with_backoff(api, **kwargs):
|
|
| 77 |
HfHubHTTPError,
|
| 78 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 79 |
max_tries=8,
|
|
|
|
|
|
|
| 80 |
jitter=backoff.full_jitter,
|
| 81 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 82 |
)
|
| 83 |
def hf_hub_download_with_backoff(**kwargs):
|
| 84 |
"""Download from HF Hub with exponential backoff on rate limit errors."""
|
|
@@ -89,8 +95,10 @@ def hf_hub_download_with_backoff(**kwargs):
|
|
| 89 |
HfHubHTTPError,
|
| 90 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 91 |
max_tries=8,
|
|
|
|
|
|
|
| 92 |
jitter=backoff.full_jitter,
|
| 93 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 94 |
)
|
| 95 |
def upload_file_with_backoff(api, **kwargs):
|
| 96 |
"""Upload file with exponential backoff on rate limit errors."""
|
|
|
|
| 53 |
HfHubHTTPError,
|
| 54 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 55 |
max_tries=8,
|
| 56 |
+
base=300,
|
| 57 |
+
max_value=3600,
|
| 58 |
jitter=backoff.full_jitter,
|
| 59 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 60 |
)
|
| 61 |
def upload_large_folder_with_backoff(api, **kwargs):
|
| 62 |
"""Upload large folder with exponential backoff on rate limit errors."""
|
|
|
|
| 67 |
HfHubHTTPError,
|
| 68 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 69 |
max_tries=8,
|
| 70 |
+
base=300,
|
| 71 |
+
max_value=3600,
|
| 72 |
jitter=backoff.full_jitter,
|
| 73 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 74 |
)
|
| 75 |
def list_repo_files_with_backoff(api, **kwargs):
|
| 76 |
"""List repo files with exponential backoff on rate limit errors."""
|
|
|
|
| 81 |
HfHubHTTPError,
|
| 82 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 83 |
max_tries=8,
|
| 84 |
+
base=300,
|
| 85 |
+
max_value=3600,
|
| 86 |
jitter=backoff.full_jitter,
|
| 87 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 88 |
)
|
| 89 |
def hf_hub_download_with_backoff(**kwargs):
|
| 90 |
"""Download from HF Hub with exponential backoff on rate limit errors."""
|
|
|
|
| 95 |
HfHubHTTPError,
|
| 96 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 97 |
max_tries=8,
|
| 98 |
+
base=300,
|
| 99 |
+
max_value=3600,
|
| 100 |
jitter=backoff.full_jitter,
|
| 101 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 102 |
)
|
| 103 |
def upload_file_with_backoff(api, **kwargs):
|
| 104 |
"""Upload file with exponential backoff on rate limit errors."""
|
msr.py
CHANGED
|
@@ -39,8 +39,10 @@ def is_rate_limit_error(e):
|
|
| 39 |
HfHubHTTPError,
|
| 40 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 41 |
max_tries=8,
|
|
|
|
|
|
|
| 42 |
jitter=backoff.full_jitter,
|
| 43 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 44 |
)
|
| 45 |
def upload_large_folder_with_backoff(api, **kwargs):
|
| 46 |
"""Upload large folder with exponential backoff on rate limit errors."""
|
|
@@ -51,8 +53,10 @@ def upload_large_folder_with_backoff(api, **kwargs):
|
|
| 51 |
HfHubHTTPError,
|
| 52 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 53 |
max_tries=8,
|
|
|
|
|
|
|
| 54 |
jitter=backoff.full_jitter,
|
| 55 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 56 |
)
|
| 57 |
def list_repo_files_with_backoff(api, **kwargs):
|
| 58 |
"""List repo files with exponential backoff on rate limit errors."""
|
|
@@ -63,8 +67,10 @@ def list_repo_files_with_backoff(api, **kwargs):
|
|
| 63 |
HfHubHTTPError,
|
| 64 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 65 |
max_tries=8,
|
|
|
|
|
|
|
| 66 |
jitter=backoff.full_jitter,
|
| 67 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 68 |
)
|
| 69 |
def hf_hub_download_with_backoff(**kwargs):
|
| 70 |
"""Download from HF Hub with exponential backoff on rate limit errors."""
|
|
@@ -75,8 +81,10 @@ def hf_hub_download_with_backoff(**kwargs):
|
|
| 75 |
HfHubHTTPError,
|
| 76 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 77 |
max_tries=8,
|
|
|
|
|
|
|
| 78 |
jitter=backoff.full_jitter,
|
| 79 |
-
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']:.1f}s
|
| 80 |
)
|
| 81 |
def upload_file_with_backoff(api, **kwargs):
|
| 82 |
"""Upload file with exponential backoff on rate limit errors."""
|
|
|
|
| 39 |
HfHubHTTPError,
|
| 40 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 41 |
max_tries=8,
|
| 42 |
+
base=300,
|
| 43 |
+
max_value=3600,
|
| 44 |
jitter=backoff.full_jitter,
|
| 45 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 46 |
)
|
| 47 |
def upload_large_folder_with_backoff(api, **kwargs):
|
| 48 |
"""Upload large folder with exponential backoff on rate limit errors."""
|
|
|
|
| 53 |
HfHubHTTPError,
|
| 54 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 55 |
max_tries=8,
|
| 56 |
+
base=300,
|
| 57 |
+
max_value=3600,
|
| 58 |
jitter=backoff.full_jitter,
|
| 59 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 60 |
)
|
| 61 |
def list_repo_files_with_backoff(api, **kwargs):
|
| 62 |
"""List repo files with exponential backoff on rate limit errors."""
|
|
|
|
| 67 |
HfHubHTTPError,
|
| 68 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 69 |
max_tries=8,
|
| 70 |
+
base=300,
|
| 71 |
+
max_value=3600,
|
| 72 |
jitter=backoff.full_jitter,
|
| 73 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 74 |
)
|
| 75 |
def hf_hub_download_with_backoff(**kwargs):
|
| 76 |
"""Download from HF Hub with exponential backoff on rate limit errors."""
|
|
|
|
| 81 |
HfHubHTTPError,
|
| 82 |
giveup=lambda e: not is_rate_limit_error(e),
|
| 83 |
max_tries=8,
|
| 84 |
+
base=300,
|
| 85 |
+
max_value=3600,
|
| 86 |
jitter=backoff.full_jitter,
|
| 87 |
+
on_backoff=lambda details: print(f" ⏳ Rate limited. Retrying in {details['wait']/60:.1f} minutes ({details['wait']:.0f}s) - attempt {details['tries']}/{8}...")
|
| 88 |
)
|
| 89 |
def upload_file_with_backoff(api, **kwargs):
|
| 90 |
"""Upload file with exponential backoff on rate limit errors."""
|