justheuristic commited on
Commit
d2e5b38
1 Parent(s): 589cdf6

adjust caches, update spaces card

Browse files
README.md CHANGED
@@ -1,19 +1,37 @@
1
  ---
2
- title: Dashboard
3
- emoji: 🌐
4
- colorFrom: blue
5
- colorTo: red
6
  sdk: streamlit
7
  app_file: app.py
8
  pinned: false
9
  ---
10
 
11
- # Training transformers together dashboard
12
 
13
- [![Generic badge](https://img.shields.io/badge/🤗-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/training-transformers-together/training-transformers-together-dashboard)
 
14
 
15
- A dashboard app for Hugging Face Spaces
 
16
 
17
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- Autogenerated using [this template](https://github.com/nateraw/spaces-template)
 
1
  ---
2
+ title: NeurIPS Demo
3
+ emoji:
4
+ colorFrom: green
5
+ colorTo: blue
6
  sdk: streamlit
7
  app_file: app.py
8
  pinned: false
9
  ---
10
 
11
+ # Configuration
12
 
13
+ `title`: _string_
14
+ Display title for the Space
15
 
16
+ `emoji`: _string_
17
+ Space emoji (emoji-only character allowed)
18
 
19
+ `colorFrom`: _string_
20
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
+
22
+ `colorTo`: _string_
23
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
+
25
+ `sdk`: _string_
26
+ Can be either `gradio` or `streamlit`
27
+
28
+ `sdk_version` : _string_
29
+ Only applicable for `streamlit` SDK.
30
+ See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
+
32
+ `app_file`: _string_
33
+ Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
+ Path is relative to the root of the repository.
35
 
36
+ `pinned`: _boolean_
37
+ Whether the Space stays on top of your list.
app.py CHANGED
@@ -1,109 +1,30 @@
1
  """
2
- This part of the website was bodged together by ham-handed hedgehogs. If something looks wrong, it's because it is.
3
  If you're not a hedgehog, you shouldn't reuse this code. Use this instead: https://docs.streamlit.io/library/get-started
4
  """
5
- import os
6
 
7
  import streamlit as st
8
- import streamlit.components.v1 as components
9
- import wandb
10
 
11
- from dashboard_utils.bubbles import get_new_bubble_data
12
- from dashboard_utils.main_metrics import get_main_metrics
13
- from streamlit_observable import observable
14
 
 
 
15
 
16
  st.set_page_config(page_title="Training Transformers Together", layout="centered")
17
- with open("static/header.html", 'r', encoding='utf-8') as f:
18
- header_html = f.read()
19
- with open("static/header_style.css", 'r', encoding='utf-8') as f:
20
- header_style_css = f.read()
21
- with open("static/header_animate.js") as f:
22
- header_animate_js = f.read()
23
- with open("static/content_style.css", 'r', encoding='utf-8') as f:
24
- content_style_css = f.read()
25
- with open("static/meta.html", 'r', encoding='utf-8') as f:
26
- meta_html = f.read()
27
 
28
- st.markdown("## Full demo content will be posted here on December 7th!")
29
-
30
- components.html(f"<style>{header_style_css}</style>{header_html}<script>{header_animate_js}</script>", height=260)
31
 
32
- st.markdown(meta_html, unsafe_allow_html=True)
33
- st.markdown(f"<style>{content_style_css}</style>", unsafe_allow_html=True) # apply css to the rest of the document
34
 
35
- def content_text(text: str, vspace_before: int = 0, vspace_after: int = 0):
36
- st.markdown(f'<center><div class="padded faded main_text" '
37
- f'style="padding-top: {vspace_before}px;padding-bottom: {vspace_after}px;">'
38
- f'{text}</div><center>',
39
- unsafe_allow_html=True)
40
- CITATIONS = {}
41
- def cite(tag):
42
- CITATIONS[tag] = len(CITATIONS) + 1
43
- return f"[{CITATIONS[tag]}]"
44
 
45
  content_text(f"""
46
  There was a time when you could comfortably train SoTA vision and language models at home on your workstation.
47
- The first ConvNet to beat ImageNet took in 5-6 days on two gamer-grade GPUs {cite("alexnet")}. Today's top-1 imagenet model
48
- took 20,000 TPU-v3 days {cite("coatnet")}. And things are even worse in the NLP world: training GPT-3 on a top-tier server
49
- with 8 A100 would still take decades {cite("gpt-3")} .""")
50
 
51
  content_text(f"""
52
  So, can individual researchers and small labs still train state-of-the-art? Yes we can!
53
  All it takes is for a bunch of us to come together. In fact, we're doing it right now and <b>you're invited to join!</b>
54
  """, vspace_before=12, vspace_after=16)
55
 
56
- source = get_main_metrics()
57
- st.vega_lite_chart(
58
- source, {
59
- "height": 200,
60
- "title": "Training DALLE with volunteers. Updated every few minutes during NeurIPS.",
61
- "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
62
- "description": "Current training progress",
63
- "encoding": {"x": {"field": "date", "type": "temporal"}},
64
- "config": {"axisX": {"labelAngle": -40}},
65
- "resolve": {"scale": {"y": "independent"}},
66
- "layer": [
67
- {
68
- "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0},
69
- "color": "#85A9C5"},
70
- "encoding": {"y": {"field": "training loss", "type": "quantitative", "axis": {"titleColor": "#85A9C5"}}},
71
- },
72
- {
73
- "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0.0},
74
- "color": "#85C5A6", "opacity": 0.5},
75
- "encoding": {
76
- "y": {"field": "active participants", "type": "quantitative", "axis": {"titleColor": "#85C5A6"}}},
77
- },
78
- ],
79
- },
80
- use_container_width=True,
81
- )
82
-
83
- #
84
- # st.caption("Number of alive runs over time")
85
- # st.vega_lite_chart(
86
- # source,
87
- # use_container_width=True,
88
- # )
89
- # st.caption("Number of steps")
90
- # st.vega_lite_chart(
91
- # source,
92
- # {
93
- # "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
94
- # "description": "Training Loss",
95
- # "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0}},
96
- # "encoding": {"x": {"field": "date", "type": "temporal"}, "y": {"field": "steps", "type": "quantitative"}},
97
- # "config": {"axisX": {"labelAngle": -40}},
98
- # },
99
- # use_container_width=True,
100
- # )
101
- #
102
- # st.header("Collaborative training participants")
103
- # serialized_data, profiles = get_new_bubble_data()
104
- # observable(
105
- # "Participants",
106
- # notebook="d/9ae236a507f54046", # "@huggingface/participants-bubbles-chart",
107
- # targets=["c_noaws"],
108
- # redefine={"serializedData": serialized_data, "profileSimple": profiles},
109
- # )
1
  """
2
+ This specific file was bodged together by ham-handed hedgehogs. If something looks wrong, it's because it is.
3
  If you're not a hedgehog, you shouldn't reuse this code. Use this instead: https://docs.streamlit.io/library/get-started
4
  """
 
5
 
6
  import streamlit as st
 
 
7
 
 
 
 
8
 
9
+ from st_helpers import make_header, content_text, cite
10
+ from charts import draw_current_progress
11
 
12
  st.set_page_config(page_title="Training Transformers Together", layout="centered")
 
 
 
 
 
 
 
 
 
 
13
 
 
 
 
14
 
15
+ st.markdown("## Full demo content will be posted here on December 7th!")
 
16
 
17
+ make_header()
 
 
 
 
 
 
 
 
18
 
19
  content_text(f"""
20
  There was a time when you could comfortably train SoTA vision and language models at home on your workstation.
21
+ The first ConvNet to beat ImageNet took in 5-6 days on two gamer-grade GPUs{cite("alexnet")}. Today's top-1 imagenet model
22
+ took 20,000 TPU-v3 days{cite("coatnet")}. And things are even worse in the NLP world: training GPT-3 on a top-tier server
23
+ with 8 A100 would still take decades{cite("gpt-3")}.""")
24
 
25
  content_text(f"""
26
  So, can individual researchers and small labs still train state-of-the-art? Yes we can!
27
  All it takes is for a bunch of us to come together. In fact, we're doing it right now and <b>you're invited to join!</b>
28
  """, vspace_before=12, vspace_after=16)
29
 
30
+ draw_current_progress()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
charts.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ from dashboard_utils.bubbles import get_new_bubble_data
4
+ from dashboard_utils.main_metrics import get_main_metrics
5
+ from streamlit_observable import observable
6
+
7
+
8
+ def draw_current_progress():
9
+ source = get_main_metrics()
10
+ st.vega_lite_chart(
11
+ source, {
12
+ "height": 200,
13
+ "title": "Training DALLE with volunteers. Updated every few minutes during NeurIPS.",
14
+ "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
15
+ "description": "Current training progress",
16
+ "encoding": {"x": {"field": "wall time", "type": "temporal"}},
17
+ "config": {"axisX": {"labelAngle": -40}},
18
+ "resolve": {"scale": {"y": "independent"}},
19
+ "layer": [
20
+ {
21
+ "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0},
22
+ "color": "#85A9C5"},
23
+ "encoding": {
24
+ "y": {"field": "training loss", "type": "quantitative", "axis": {"titleColor": "#85A9C5"}}},
25
+ },
26
+ {
27
+ "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0.0},
28
+ "color": "#85C5A6", "opacity": 0.5},
29
+ "encoding": {
30
+ "y": {"field": "active participants", "type": "quantitative",
31
+ "axis": {"titleColor": "#85C5A6"}}},
32
+ },
33
+ ],
34
+ },
35
+ use_container_width=True,
36
+ )
37
+
38
+ with st.expander("Who's training?", expanded=False):
39
+ st.markdown("### Collaborative training participants\n(may take a few seconds to load)")
40
+
41
+ serialized_data, profiles = get_new_bubble_data()
42
+ observable(
43
+ "Participants",
44
+ notebook="d/9ae236a507f54046", # "@huggingface/participants-bubbles-chart",
45
+ targets=["c_noaws"],
46
+ redefine={"serializedData": serialized_data, "profileSimple": profiles},
47
+ )
dashboard_utils/bubbles.py CHANGED
@@ -10,7 +10,7 @@ from dashboard_utils.time_tracker import _log, simple_time_tracker
10
 
11
  URL_QUICKSEARCH = "https://huggingface.co/api/quicksearch?"
12
  WANDB_REPO = "learning-at-home/Worker_logs"
13
- CACHE_TTL = 100
14
 
15
 
16
  @st.cache(ttl=CACHE_TTL)
10
 
11
  URL_QUICKSEARCH = "https://huggingface.co/api/quicksearch?"
12
  WANDB_REPO = "learning-at-home/Worker_logs"
13
+ CACHE_TTL = 600
14
 
15
 
16
  @st.cache(ttl=CACHE_TTL)
dashboard_utils/main_metrics.py CHANGED
@@ -30,4 +30,4 @@ def get_main_metrics():
30
  alive_peers.append(row["alive peers"])
31
  dates.append(datetime.datetime.utcfromtimestamp(row["_timestamp"]))
32
 
33
- return pd.DataFrame({"steps": steps, "training loss": losses, "active participants": alive_peers, "date": dates})
30
  alive_peers.append(row["alive peers"])
31
  dates.append(datetime.datetime.utcfromtimestamp(row["_timestamp"]))
32
 
33
+ return pd.DataFrame({"steps": steps, "training loss": losses, "active participants": alive_peers, "wall time": dates})
st_helpers.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import streamlit.components.v1 as components
3
+
4
+ with open("static/header.html", 'r', encoding='utf-8') as f:
5
+ header_html = f.read()
6
+ with open("static/header_style.css", 'r', encoding='utf-8') as f:
7
+ header_style_css = f.read()
8
+ with open("static/header_animate.js") as f:
9
+ header_animate_js = f.read()
10
+ with open("static/content_style.css", 'r', encoding='utf-8') as f:
11
+ content_style_css = f.read()
12
+ with open("static/meta.html", 'r', encoding='utf-8') as f:
13
+ meta_html = f.read()
14
+
15
+
16
+ def make_header():
17
+ components.html(f"<style>{header_style_css}</style>{header_html}<script>{header_animate_js}</script>", height=260)
18
+ st.markdown(meta_html, unsafe_allow_html=True)
19
+ st.markdown(f"<style>{content_style_css}</style>", unsafe_allow_html=True) # apply css to the rest of the document
20
+
21
+
22
+ def content_text(text: str, vspace_before: int = 0, vspace_after: int = 0):
23
+ st.markdown(f'<center><div class="padded faded main_text" '
24
+ f'style="padding-top: {vspace_before}px; padding-bottom: {vspace_after}px; text-align: justify;">'
25
+ f'{text}</div><center>',
26
+ unsafe_allow_html=True)
27
+
28
+
29
+ CITATIONS = {}
30
+
31
+
32
+ def cite(tag):
33
+ CITATIONS[tag] = len(CITATIONS) + 1
34
+ return f"&nbsp;[{CITATIONS[tag]}]"