tju01 commited on
Commit
b82aeff
1 Parent(s): e61a555

Allow submitting models with remote code

Browse files

If 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.

Files changed (1) hide show
  1. app.py +2 -2
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 AutoConfig
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 = AutoConfig.from_pretrained(model_name, revision=revision)
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: