alozowski HF staff commited on
Commit
d852c46
1 Parent(s): 5ccae0d

Improve error messages for model validation and gated model handling

Browse files
backend/app/utils/model_validation.py CHANGED
@@ -196,15 +196,15 @@ class ModelValidator:
196
  token=self.token
197
  )
198
  except ValueError as e:
199
- return False, f"uses a tokenizer which is not in a transformers release: {e}", None
200
  except Exception:
201
- return False, "'s tokenizer cannot be loaded. Is your tokenizer class in a stable transformers release, and correctly configured?", None
202
 
203
  return True, None, config
204
 
205
  except ValueError:
206
- return False, "needs to be launched with `trust_remote_code=True`. For safety reason, we do not allow these models to be automatically submitted to the leaderboard.", None
207
  except Exception as e:
208
  if "You are trying to access a gated repo." in str(e):
209
- return True, "uses a gated model.", None
210
- return False, f"was not found or misconfigured on the hub! Error raised was {e.args[0]}", None
 
196
  token=self.token
197
  )
198
  except ValueError as e:
199
+ return False, f"The tokenizer is not available in an official Transformers release: {e}", None
200
  except Exception:
201
+ return False, "The tokenizer cannot be loaded. Ensure the tokenizer class is part of a stable Transformers release and correctly configured.", None
202
 
203
  return True, None, config
204
 
205
  except ValueError:
206
+ return False, "The model requires `trust_remote_code=True` to launch, and for safety reasons, we don't accept such models automatically.", None
207
  except Exception as e:
208
  if "You are trying to access a gated repo." in str(e):
209
+ return True, "The model is gated and requires special access permissions.", None
210
+ return False, f"The model was not found or is misconfigured on the Hub. Error: {e.args[0]}", None