Spaces:
Paused
Paused
Clémentine
commited on
Commit
•
f3cda22
1
Parent(s):
f69c85c
token for checking gated base models
Browse files- app.py +1 -1
- src/filters.py +3 -2
app.py
CHANGED
@@ -140,7 +140,7 @@ def add_new_eval(
|
|
140 |
revision = "main"
|
141 |
|
142 |
if weight_type in ["Delta", "Adapter"]:
|
143 |
-
base_model_on_hub, error = is_model_on_hub(base_model, revision)
|
144 |
if not base_model_on_hub:
|
145 |
return styled_error(f'Base model "{base_model}" {error}')
|
146 |
|
|
|
140 |
revision = "main"
|
141 |
|
142 |
if weight_type in ["Delta", "Adapter"]:
|
143 |
+
base_model_on_hub, error = is_model_on_hub(base_model, revision, H4_TOKEN)
|
144 |
if not base_model_on_hub:
|
145 |
return styled_error(f'Base model "{base_model}" {error}')
|
146 |
|
src/filters.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import huggingface_hub
|
|
|
2 |
from huggingface_hub import ModelCard
|
3 |
from transformers import AutoConfig
|
4 |
|
@@ -29,9 +30,9 @@ def check_model_card(repo_id: str) -> tuple[bool, str]:
|
|
29 |
return True, ""
|
30 |
|
31 |
|
32 |
-
def is_model_on_hub(model_name: str, revision: str) -> bool:
|
33 |
try:
|
34 |
-
AutoConfig.from_pretrained(model_name, revision=revision, trust_remote_code=False)
|
35 |
return True, None
|
36 |
|
37 |
except ValueError:
|
|
|
1 |
import huggingface_hub
|
2 |
+
import os
|
3 |
from huggingface_hub import ModelCard
|
4 |
from transformers import AutoConfig
|
5 |
|
|
|
30 |
return True, ""
|
31 |
|
32 |
|
33 |
+
def is_model_on_hub(model_name: str, revision: str, token: str = None) -> bool:
|
34 |
try:
|
35 |
+
AutoConfig.from_pretrained(model_name, revision=revision, trust_remote_code=False, token=token)
|
36 |
return True, None
|
37 |
|
38 |
except ValueError:
|