Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Allow submitting models with remote code
Browse filesIf a model contains remote code, then using `AutoConfig.from_pretrained` fails without trust_remote_code=True. Alternatively, using `PretrainedConfig.get_config_dict` is sufficient to check whether a model is available and doesn't require executing remote code, even if it exists.
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import pandas as pd
|
|
| 9 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 10 |
from content import *
|
| 11 |
from huggingface_hub import Repository, HfApi
|
| 12 |
-
from transformers import
|
| 13 |
from utils import get_eval_results_dicts, make_clickable_model
|
| 14 |
|
| 15 |
# clone / pull the lmeh eval data
|
|
@@ -224,7 +224,7 @@ leaderboard_df = original_df.copy()
|
|
| 224 |
|
| 225 |
def is_model_on_hub(model_name, revision) -> bool:
|
| 226 |
try:
|
| 227 |
-
config =
|
| 228 |
return True
|
| 229 |
|
| 230 |
except Exception as e:
|
|
|
|
| 9 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 10 |
from content import *
|
| 11 |
from huggingface_hub import Repository, HfApi
|
| 12 |
+
from transformers import PretrainedConfig
|
| 13 |
from utils import get_eval_results_dicts, make_clickable_model
|
| 14 |
|
| 15 |
# clone / pull the lmeh eval data
|
|
|
|
| 224 |
|
| 225 |
def is_model_on_hub(model_name, revision) -> bool:
|
| 226 |
try:
|
| 227 |
+
config = PretrainedConfig.get_config_dict(model_name, revision=revision)
|
| 228 |
return True
|
| 229 |
|
| 230 |
except Exception as e:
|