sasha HF staff commited on
Commit
0a426a3
1 Parent(s): 42411ac

updating plots, data

Browse files
Files changed (2) hide show
  1. app.py +22 -3
  2. data/co2_data.csv +0 -0
app.py CHANGED
@@ -11,11 +11,12 @@ model_performance_df = pd.read_csv('data/performance.csv', header=0)
11
  emissions_df = pd.read_csv('data/co2_data.csv',header=0)
12
  modalities_df = pd.read_csv('data/modalities_data.csv',header=0)
13
  finetuned_df = emissions_df[~emissions_df['task'].str.contains('zero')]
 
14
 
15
- fig0 = px.scatter(finetuned_df, x="dataset", y="query emissions (g)", color="model", log_y=True)
16
  fig0.update_layout(xaxis={'categoryorder':'mean ascending'})
17
  fig0.update_layout(yaxis_title='Total carbon emitted (g)')
18
- fig0.update_layout(xaxis_title='Dataset')
19
 
20
 
21
  fig1 = px.box(finetuned_df, x="task", y="query_energy (kWh)", color="task", log_y=True)
@@ -40,15 +41,33 @@ demo = gr.Blocks()
40
 
41
  with demo:
42
  gr.Markdown("# CO2 Inference Demo")
43
- gr.Markdown("## Explore the plots below to get more insights about the different models and tasks from our study.")
 
 
 
 
 
 
 
44
  with gr.Row():
45
  with gr.Column():
 
 
 
46
  gr.Plot(fig0)
47
  with gr.Row():
48
  with gr.Column():
 
 
 
 
49
  gr.Plot(fig1)
50
  with gr.Row():
51
  with gr.Column():
 
 
 
 
52
  gr.Plot(fig2)
53
 
54
 
 
11
  emissions_df = pd.read_csv('data/co2_data.csv',header=0)
12
  modalities_df = pd.read_csv('data/modalities_data.csv',header=0)
13
  finetuned_df = emissions_df[~emissions_df['task'].str.contains('zero')]
14
+ finetuned_df['task'] = finetuned_df['task'].str.replace('_',' ')
15
 
16
+ fig0 = px.scatter(emissions_df, x="num_params", y="query emissions (g)", color="model", log_x=True, log_y=True)
17
  fig0.update_layout(xaxis={'categoryorder':'mean ascending'})
18
  fig0.update_layout(yaxis_title='Total carbon emitted (g)')
19
+ fig0.update_layout(xaxis_title='Number of Parameters')
20
 
21
 
22
  fig1 = px.box(finetuned_df, x="task", y="query_energy (kWh)", color="task", log_y=True)
 
41
 
42
  with demo:
43
  gr.Markdown("# CO2 Inference Demo")
44
+ gr.Markdown("## TL;DR - We ran a series of experiments to measure the energy efficiency and carbon emissions of different\
45
+ models from the HuggingFace Hub, and to see how different tasks and models compare.\
46
+ Explore the plots below to get more insights about the different models and tasks from our study.")
47
+ with gr.Accordion("More details about our methodology:", open=False):
48
+ gr.Markdown("We chose ten ML tasks: text classification, token classification, question answering, \
49
+ ), masked language modeling, text generation, summarization, image classification, object detection, \
50
+ image captioning and image generation. For each of the taks, we chose three of the most downloaded datasets and 8 of the most \
51
+ downloaded models from the Hugging Face Hub. We ran each of the models ten times over a 1,000 sample from each of the models and measured the energy consumed and carbon emitted.")
52
  with gr.Row():
53
  with gr.Column():
54
+ gr.Markdown("## All models from our study (carbon)")
55
+ gr.Markdown("### Double click on the model name in the list on the right to isolate its datapoints:")
56
+ gr.Markdown("The axes of the plot are in logarithmic scale, meaning that the difference between the least carbon-intensive and the most carbon-intensive models is over 9,000 times!")
57
  gr.Plot(fig0)
58
  with gr.Row():
59
  with gr.Column():
60
+ gr.Markdown("## Task-by-task comparison (energy)")
61
+ gr.Markdown("### Grouping the models by task, we can see different patterns emerge:")
62
+ gr.Markdown("Image generation is by far the most energy- and carbon-intensive task from the ones studied, and text classification \
63
+ is the least.")
64
  gr.Plot(fig1)
65
  with gr.Row():
66
  with gr.Column():
67
+ gr.Markdown("## Modality comparison (carbon)")
68
+ gr.Markdown("### Grouping the models by their modality shows the different characteristics of each one:")
69
+ gr.Markdown("We can see that tasks involving images (image-to-text, image-to-category) require more energy and emit more carbon\
70
+ than ones inolving text.")
71
  gr.Plot(fig2)
72
 
73
 
data/co2_data.csv CHANGED
The diff for this file is too large to render. See raw diff