Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Clémentine
commited on
Commit
·
4476a88
1
Parent(s):
2e6f6b1
fixed bug in #277
Browse files
app.py
CHANGED
@@ -237,12 +237,12 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
|
|
237 |
return filtered_df
|
238 |
|
239 |
NUMERIC_INTERVALS = {
|
240 |
-
"< 1.5B": (0, 1.5),
|
241 |
-
"~3B": (1.5, 5),
|
242 |
-
"~7B": (6, 11),
|
243 |
-
"~13B": (12, 15),
|
244 |
-
"~35B": (16, 55),
|
245 |
-
"60B+": (55, 10000),
|
246 |
}
|
247 |
|
248 |
def filter_models(
|
@@ -257,9 +257,10 @@ def filter_models(
|
|
257 |
type_emoji = [t[0] for t in type_query]
|
258 |
filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
259 |
|
260 |
-
numeric_interval = [NUMERIC_INTERVALS[s] for s in size_query]
|
261 |
params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
|
262 |
-
|
|
|
263 |
|
264 |
return filtered_df
|
265 |
|
|
|
237 |
return filtered_df
|
238 |
|
239 |
NUMERIC_INTERVALS = {
|
240 |
+
"< 1.5B": pd.Interval(0, 1.5, closed="both"),
|
241 |
+
"~3B": pd.Interval(1.5, 5, closed="both"),
|
242 |
+
"~7B": pd.Interval(6, 11, closed="both"),
|
243 |
+
"~13B": pd.Interval(12, 15, closed="both"),
|
244 |
+
"~35B": pd.Interval(16, 55, closed="both"),
|
245 |
+
"60B+": pd.Interval(55, 10000, closed="both"),
|
246 |
}
|
247 |
|
248 |
def filter_models(
|
|
|
257 |
type_emoji = [t[0] for t in type_query]
|
258 |
filtered_df = filtered_df[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
|
259 |
|
260 |
+
numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
|
261 |
params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
|
262 |
+
mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
|
263 |
+
filtered_df = filtered_df.loc[mask]
|
264 |
|
265 |
return filtered_df
|
266 |
|