Nathan Habib commited on
Commit
f485a37
β€’
1 Parent(s): 2ef734a

Fix search bar by not filtered models with unknown model type

Browse files
app.py CHANGED
@@ -225,6 +225,7 @@ def update_table(hidden_df: pd.DataFrame, current_columns_df: pd.DataFrame, colu
225
  return df
226
 
227
  def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
 
228
  return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
229
 
230
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
@@ -258,6 +259,7 @@ def filter_models(
258
  filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
259
 
260
  type_emoji = [t[0] for t in type_query]
 
261
  filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
262
  filtered_df = filtered_df[df[AutoEvalColumn.precision.name].isin(precision_query)]
263
 
@@ -325,12 +327,14 @@ with demo:
325
  ModelType.FT.to_str(),
326
  ModelType.IFT.to_str(),
327
  ModelType.RL.to_str(),
 
328
  ],
329
  value=[
330
  ModelType.PT.to_str(),
331
  ModelType.FT.to_str(),
332
  ModelType.IFT.to_str(),
333
  ModelType.RL.to_str(),
 
334
  ],
335
  interactive=True,
336
  elem_id="filter-columns-type",
 
225
  return df
226
 
227
  def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
228
+ print(query)
229
  return df[(df[AutoEvalColumn.dummy.name].str.contains(query, case=False))]
230
 
231
  def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
 
259
  filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
260
 
261
  type_emoji = [t[0] for t in type_query]
262
+ print(type_emoji)
263
  filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
264
  filtered_df = filtered_df[df[AutoEvalColumn.precision.name].isin(precision_query)]
265
 
 
327
  ModelType.FT.to_str(),
328
  ModelType.IFT.to_str(),
329
  ModelType.RL.to_str(),
330
+ ModelType.Unknown.to_str(),
331
  ],
332
  value=[
333
  ModelType.PT.to_str(),
334
  ModelType.FT.to_str(),
335
  ModelType.IFT.to_str(),
336
  ModelType.RL.to_str(),
337
+ ModelType.Unknown.to_str(),
338
  ],
339
  interactive=True,
340
  elem_id="filter-columns-type",
src/display_models/get_model_metadata.py CHANGED
@@ -85,7 +85,7 @@ def get_model_size(model_name, model_info):
85
  with init_empty_weights():
86
  model = AutoModel.from_config(config, trust_remote_code=False)
87
  return round(sum(p.numel() for p in model.parameters() if p.requires_grad) / 1e9, 3)
88
- except (EnvironmentError, ValueError): # model config not found, likely private
89
  try:
90
  size_match = re.search(size_pattern, model_name.lower())
91
  size = size_match.group(0)
 
85
  with init_empty_weights():
86
  model = AutoModel.from_config(config, trust_remote_code=False)
87
  return round(sum(p.numel() for p in model.parameters() if p.requires_grad) / 1e9, 3)
88
+ except (EnvironmentError, ValueError, KeyError): # model config not found, likely private
89
  try:
90
  size_match = re.search(size_pattern, model_name.lower())
91
  size = size_match.group(0)
src/display_models/model_metadata_type.py CHANGED
@@ -14,7 +14,7 @@ class ModelType(Enum):
14
  FT = ModelInfo(name="fine-tuned", symbol="πŸ”Ά")
15
  IFT = ModelInfo(name="instruction-tuned", symbol="β­•")
16
  RL = ModelInfo(name="RL-tuned", symbol="🟦")
17
- Unknown = ModelInfo(name="Unknown, add type to request file!", symbol="?")
18
 
19
  def to_str(self, separator=" "):
20
  return f"{self.value.symbol}{separator}{self.value.name}"
 
14
  FT = ModelInfo(name="fine-tuned", symbol="πŸ”Ά")
15
  IFT = ModelInfo(name="instruction-tuned", symbol="β­•")
16
  RL = ModelInfo(name="RL-tuned", symbol="🟦")
17
+ Unknown = ModelInfo(name="Unknown", symbol="?")
18
 
19
  def to_str(self, separator=" "):
20
  return f"{self.value.symbol}{separator}{self.value.name}"