rahuketu86 commited on
Commit
12c1a22
·
1 Parent(s): 05e19dd

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -11,7 +11,10 @@ import plotly.express as px
11
  from fastcore.all import *
12
  import streamlit as st
13
 
14
- # %% 03a_image_archs.ipynb 13
 
 
 
15
  def get_results(result_option = 'original'):
16
  suffix = "" if result_option == 'original' else "-real"
17
  url_results = f"https://github.com/huggingface/pytorch-image-models/raw/main/results/results-imagenet{suffix}.csv"
@@ -20,7 +23,7 @@ def get_results(result_option = 'original'):
20
  df_results['model'] = df_results['model'].str.split('.').str[0]
21
  return df_results
22
 
23
- # %% 03a_image_archs.ipynb 15
24
  def get_integrated_data(activity_option, result_option):
25
  df_results = get_results(result_option)
26
  url_benchmark = f"https://github.com/huggingface/pytorch-image-models/raw/main/results/benchmark-{activity_option}-amp-nhwc-pt112-cu113-rtx3090.csv"
@@ -32,7 +35,7 @@ def get_integrated_data(activity_option, result_option):
32
  df_integrated.loc[df_integrated.model.str.contains('resnet.*d'), 'family'] = df_integrated.loc[df_integrated.model.str.contains('resnet.*d'), 'family'] + "d"
33
  return df_integrated[~df_integrated.model.str.endswith('gn')] # Group norm models. Why Jeremy eliminated them from analysis?
34
 
35
- # %% 03a_image_archs.ipynb 17
36
  @st.cache_data
37
  def get_filtered_data(df_integrated, subs, is_fullmatch=False, drop_tf=True):
38
  if drop_tf: df_integrated = df_integrated[~df_integrated.is_tensorflow_model]
@@ -40,7 +43,7 @@ def get_filtered_data(df_integrated, subs, is_fullmatch=False, drop_tf=True):
40
  elif is_fullmatch: return df_integrated[df_integrated.family.str.fullmatch(subs)]
41
  else: return df_integrated[df_integrated.model.str.contains(subs)]
42
 
43
- # %% 03a_image_archs.ipynb 18
44
  def get_data(col_option, activity_option, result_option, subs, is_fullmatch=False, drop_tf=True):
45
  col = "_".join([activity_option, col_option])
46
  df_integrated = get_integrated_data(activity_option, result_option)
@@ -48,7 +51,7 @@ def get_data(col_option, activity_option, result_option, subs, is_fullmatch=Fals
48
  df_integrated['secs'] =1./df_integrated[col]
49
  return df_integrated
50
 
51
- # %% 03a_image_archs.ipynb 19
52
  def plot_selection(df, title, col_option, activity_option, w=1000, h=800):
53
  size_col = "_".join([activity_option, col_option])
54
  return px.scatter(df, width=w, height=h, size=df[size_col]**2,trendline="ols", trendline_options={'log_x':True},
@@ -57,7 +60,7 @@ def plot_selection(df, title, col_option, activity_option, w=1000, h=800):
57
  hover_data=[size_col])
58
 
59
 
60
- # %% 03a_image_archs.ipynb 20
61
  result_options = ['original', 'real'] #result = 'real'
62
  activity_options = ['train', 'infer']
63
  col_options = ['samples_per_sec', 'step_time', 'batch_size', 'img_size', 'gmacs', 'macts']
@@ -74,8 +77,7 @@ title_dict = dict(zip(activity_options, ['Training', "Inference"]))
74
  df = get_data(col_option, activity_option, result_option, subs, is_fullmatch=is_fullmatch, drop_tf=drop_tf)
75
  fig = plot_selection(df, title_dict[activity_option], size_col_option, activity_option)
76
 
77
- # %% 03a_image_archs.ipynb 24
78
- st.set_page_config(page_title="Which Image Model is best?",layout="wide")
79
  st.title("Which Image Model is best?")
80
  col1, col2 = st.columns([1,3])
81
  with col1:
 
11
  from fastcore.all import *
12
  import streamlit as st
13
 
14
+ # %% 03a_image_archs.ipynb 12
15
+ st.set_page_config(page_title="Which Image Model is best?",layout="wide")
16
+
17
+ # %% 03a_image_archs.ipynb 14
18
  def get_results(result_option = 'original'):
19
  suffix = "" if result_option == 'original' else "-real"
20
  url_results = f"https://github.com/huggingface/pytorch-image-models/raw/main/results/results-imagenet{suffix}.csv"
 
23
  df_results['model'] = df_results['model'].str.split('.').str[0]
24
  return df_results
25
 
26
+ # %% 03a_image_archs.ipynb 16
27
  def get_integrated_data(activity_option, result_option):
28
  df_results = get_results(result_option)
29
  url_benchmark = f"https://github.com/huggingface/pytorch-image-models/raw/main/results/benchmark-{activity_option}-amp-nhwc-pt112-cu113-rtx3090.csv"
 
35
  df_integrated.loc[df_integrated.model.str.contains('resnet.*d'), 'family'] = df_integrated.loc[df_integrated.model.str.contains('resnet.*d'), 'family'] + "d"
36
  return df_integrated[~df_integrated.model.str.endswith('gn')] # Group norm models. Why Jeremy eliminated them from analysis?
37
 
38
+ # %% 03a_image_archs.ipynb 18
39
  @st.cache_data
40
  def get_filtered_data(df_integrated, subs, is_fullmatch=False, drop_tf=True):
41
  if drop_tf: df_integrated = df_integrated[~df_integrated.is_tensorflow_model]
 
43
  elif is_fullmatch: return df_integrated[df_integrated.family.str.fullmatch(subs)]
44
  else: return df_integrated[df_integrated.model.str.contains(subs)]
45
 
46
+ # %% 03a_image_archs.ipynb 19
47
  def get_data(col_option, activity_option, result_option, subs, is_fullmatch=False, drop_tf=True):
48
  col = "_".join([activity_option, col_option])
49
  df_integrated = get_integrated_data(activity_option, result_option)
 
51
  df_integrated['secs'] =1./df_integrated[col]
52
  return df_integrated
53
 
54
+ # %% 03a_image_archs.ipynb 20
55
  def plot_selection(df, title, col_option, activity_option, w=1000, h=800):
56
  size_col = "_".join([activity_option, col_option])
57
  return px.scatter(df, width=w, height=h, size=df[size_col]**2,trendline="ols", trendline_options={'log_x':True},
 
60
  hover_data=[size_col])
61
 
62
 
63
+ # %% 03a_image_archs.ipynb 21
64
  result_options = ['original', 'real'] #result = 'real'
65
  activity_options = ['train', 'infer']
66
  col_options = ['samples_per_sec', 'step_time', 'batch_size', 'img_size', 'gmacs', 'macts']
 
77
  df = get_data(col_option, activity_option, result_option, subs, is_fullmatch=is_fullmatch, drop_tf=drop_tf)
78
  fig = plot_selection(df, title_dict[activity_option], size_col_option, activity_option)
79
 
80
+ # %% 03a_image_archs.ipynb 25
 
81
  st.title("Which Image Model is best?")
82
  col1, col2 = st.columns([1,3])
83
  with col1: