sasha HF staff commited on
Commit
23c7589
β€’
1 Parent(s): 7e00f76

trying to make parameters easier to read

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -11,6 +11,7 @@ def get_plots(task):
11
  all_df = pd.merge(task_df, params_df, on='model')
12
  all_df['Total GPU Energy (Wh)'] = all_df['total_gpu_energy']*1000
13
  all_df = all_df.sort_values(by=['Total GPU Energy (Wh)'])
 
14
  all_df['energy_star'] = pd.cut(all_df['Total GPU Energy (Wh)'], 3, labels=["⭐⭐⭐", "⭐⭐", "⭐"])
15
  fig = px.scatter(all_df, x="model", y='Total GPU Energy (Wh)', custom_data=['parameters'], height= 500, width= 800, color = 'energy_star', color_discrete_map={"⭐": 'red', "⭐⭐": "yellow", "⭐⭐⭐": "green"})
16
  fig.update_traces(
@@ -27,6 +28,13 @@ def get_model_names(task_data):
27
  model_names = task_df[['model']]
28
  return model_names
29
 
 
 
 
 
 
 
 
30
 
31
  demo = gr.Blocks()
32
 
 
11
  all_df = pd.merge(task_df, params_df, on='model')
12
  all_df['Total GPU Energy (Wh)'] = all_df['total_gpu_energy']*1000
13
  all_df = all_df.sort_values(by=['Total GPU Energy (Wh)'])
14
+ all_df['parameters'] = all_df['parameters'].apply(format_params)
15
  all_df['energy_star'] = pd.cut(all_df['Total GPU Energy (Wh)'], 3, labels=["⭐⭐⭐", "⭐⭐", "⭐"])
16
  fig = px.scatter(all_df, x="model", y='Total GPU Energy (Wh)', custom_data=['parameters'], height= 500, width= 800, color = 'energy_star', color_discrete_map={"⭐": 'red', "⭐⭐": "yellow", "⭐⭐⭐": "green"})
17
  fig.update_traces(
 
28
  model_names = task_df[['model']]
29
  return model_names
30
 
31
+ def format_params(num):
32
+ if num > 1000000000:
33
+ if not num % 1000000000:
34
+ return f'{num // 1000000000}B'
35
+ return f'{round(num / 1000000000, 1)}B'
36
+ return f'{num // 1000000}M'
37
+
38
 
39
  demo = gr.Blocks()
40