Spaces:
Runtime error
Runtime error
Clémentine
commited on
Commit
•
8d502c8
1
Parent(s):
ae618a2
fix
Browse files
src/scripts/update_all_request_files.py
CHANGED
@@ -4,7 +4,7 @@ from huggingface_hub import ModelCard
|
|
4 |
import json
|
5 |
import time
|
6 |
from src.submission.check_validity import is_model_on_hub, check_model_card
|
7 |
-
from src.envs import DYNAMIC_INFO_REPO, DYNAMIC_INFO_PATH, DYNAMIC_INFO_FILE_PATH, API
|
8 |
|
9 |
def update_models(file_path, models):
|
10 |
"""
|
@@ -30,7 +30,7 @@ def update_models(file_path, models):
|
|
30 |
|
31 |
# Is the model still on the hub
|
32 |
still_on_hub, error, model_config = is_model_on_hub(
|
33 |
-
model_name=model_id, revision=data.get("revision"), trust_remote_code=True, test_tokenizer=False
|
34 |
)
|
35 |
# If the model doesn't have a model card or a license, we consider it's deleted
|
36 |
if still_on_hub:
|
@@ -88,12 +88,13 @@ def update_dynamic_files():
|
|
88 |
cardData=True,
|
89 |
fetch_config=True,
|
90 |
))
|
|
|
91 |
|
92 |
print(f"UPDATE_DYNAMIC: Downloaded list of models in {time.time() - start:.2f} seconds")
|
93 |
|
94 |
start = time.time()
|
95 |
|
96 |
-
update_models(DYNAMIC_INFO_FILE_PATH,
|
97 |
|
98 |
print(f"UPDATE_DYNAMIC: updated in {time.time() - start:.2f} seconds")
|
99 |
|
|
|
4 |
import json
|
5 |
import time
|
6 |
from src.submission.check_validity import is_model_on_hub, check_model_card
|
7 |
+
from src.envs import DYNAMIC_INFO_REPO, DYNAMIC_INFO_PATH, DYNAMIC_INFO_FILE_PATH, API, H4_TOKEN
|
8 |
|
9 |
def update_models(file_path, models):
|
10 |
"""
|
|
|
30 |
|
31 |
# Is the model still on the hub
|
32 |
still_on_hub, error, model_config = is_model_on_hub(
|
33 |
+
model_name=model_id, revision=data.get("revision"), trust_remote_code=True, test_tokenizer=False, token=H4_TOKEN
|
34 |
)
|
35 |
# If the model doesn't have a model card or a license, we consider it's deleted
|
36 |
if still_on_hub:
|
|
|
88 |
cardData=True,
|
89 |
fetch_config=True,
|
90 |
))
|
91 |
+
id_to_model = {model.id : model for model in models}
|
92 |
|
93 |
print(f"UPDATE_DYNAMIC: Downloaded list of models in {time.time() - start:.2f} seconds")
|
94 |
|
95 |
start = time.time()
|
96 |
|
97 |
+
update_models(DYNAMIC_INFO_FILE_PATH, id_to_model)
|
98 |
|
99 |
print(f"UPDATE_DYNAMIC: updated in {time.time() - start:.2f} seconds")
|
100 |
|