muellerzr HF staff commited on
Commit
dd566c3
1 Parent(s): 15489b7

better err for detr

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -84,9 +84,12 @@ def calculate_memory(model_name:str, library:str, options:list, access_token:str
84
  library = check_has_model(e)
85
  if library != "unknown":
86
  raise gr.Error(f"Tried to load `{model_name}` with `{library}` but a possible model to load was not found inside the repo.")
 
87
  except ImportError:
88
  # hacky way to check if it works with `trust_remote_code=False`
89
  model = create_empty_model(model_name, library_name=library, trust_remote_code=False, access_token=access_token)
 
 
90
  total_size, largest_layer = calculate_maximum_sizes(model)
91
 
92
  data = []
 
84
  library = check_has_model(e)
85
  if library != "unknown":
86
  raise gr.Error(f"Tried to load `{model_name}` with `{library}` but a possible model to load was not found inside the repo.")
87
+ raise gr.Error(f"Model `{model_name}` had an error, please open a discussion on the model's page with the error message and name: `{e}`")
88
  except ImportError:
89
  # hacky way to check if it works with `trust_remote_code=False`
90
  model = create_empty_model(model_name, library_name=library, trust_remote_code=False, access_token=access_token)
91
+ except Exception as e:
92
+ raise gr.Error(f"Model `{model_name}` had an error, please open a discussion on the model's page with the error message and name: `{e}`")
93
  total_size, largest_layer = calculate_maximum_sizes(model)
94
 
95
  data = []