SaulLu commited on
Commit
57845b8
1 Parent(s): f1046eb

change altair to vega

Browse files
Files changed (2) hide show
  1. app.py +41 -7
  2. dashboard_utils/main_metrics.py +6 -2
app.py CHANGED
@@ -12,15 +12,49 @@ wandb.login(anonymous="must")
12
  st.title("Training transformers together dashboard")
13
  st.caption("Training Loss")
14
 
15
- steps, losses, alive_peers = get_main_metrics()
16
- source = pd.DataFrame({"steps": steps, "loss": losses, "alive participants": alive_peers})
17
 
18
- chart_loss = alt.Chart(source).mark_line().encode(x="steps", y="loss")
19
- st.altair_chart(chart_loss, use_container_width=True)
20
 
21
- st.caption("Number of alive participants over time")
22
- chart_alive_peer = alt.Chart(source).mark_line().encode(x="steps", y="alive participants")
23
- st.altair_chart(chart_alive_peer, use_container_width=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  st.header("Collaborative training participants")
26
  serialized_data, profiles = get_new_bubble_data()
 
12
  st.title("Training transformers together dashboard")
13
  st.caption("Training Loss")
14
 
15
+ steps, dates, losses, alive_peers = get_main_metrics()
16
+ source = pd.DataFrame({"steps": steps, "loss": losses, "alive participants": alive_peers, "date": dates})
17
 
 
 
18
 
19
+ st.vega_lite_chart(
20
+ source,
21
+ {
22
+ "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
23
+ "description": "Training Loss",
24
+ "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0}},
25
+ "encoding": {"x": {"field": "date", "type": "temporal"}, "y": {"field": "loss", "type": "quantitative"}},
26
+ "config": {"axisX": {"labelAngle": -40}},
27
+ },
28
+ use_container_width=True,
29
+ )
30
+
31
+ st.caption("Number of alive runs over time")
32
+ st.vega_lite_chart(
33
+ source,
34
+ {
35
+ "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
36
+ "description": "Alive participants",
37
+ "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0}},
38
+ "encoding": {
39
+ "x": {"field": "date", "type": "temporal"},
40
+ "y": {"field": "alive participants", "type": "quantitative"},
41
+ },
42
+ "config": {"axisX": {"labelAngle": -40}},
43
+ },
44
+ use_container_width=True,
45
+ )
46
+ st.caption("Number of steps")
47
+ st.vega_lite_chart(
48
+ source,
49
+ {
50
+ "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
51
+ "description": "Training Loss",
52
+ "mark": {"type": "line", "point": {"tooltip": True, "filled": False, "strokeOpacity": 0}},
53
+ "encoding": {"x": {"field": "date", "type": "temporal"}, "y": {"field": "steps", "type": "quantitative"}},
54
+ "config": {"axisX": {"labelAngle": -40}},
55
+ },
56
+ use_container_width=True,
57
+ )
58
 
59
  st.header("Collaborative training participants")
60
  serialized_data, profiles = get_new_bubble_data()
dashboard_utils/main_metrics.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import wandb
2
 
3
  from dashboard_utils.time_tracker import _log, simple_time_tracker
@@ -10,14 +12,16 @@ def get_main_metrics():
10
  api = wandb.Api()
11
  runs = api.runs(WANDB_REPO)
12
  run = runs[0]
13
- history = run.scan_history(keys=["step", "loss", "alive peers"])
14
 
15
  steps = []
16
  losses = []
17
  alive_peers = []
 
18
  for row in history:
19
  steps.append(row["step"])
20
  losses.append(row["loss"])
21
  alive_peers.append(row["alive peers"])
 
22
 
23
- return steps, losses, alive_peers
 
1
+ import datetime
2
+
3
  import wandb
4
 
5
  from dashboard_utils.time_tracker import _log, simple_time_tracker
 
12
  api = wandb.Api()
13
  runs = api.runs(WANDB_REPO)
14
  run = runs[0]
15
+ history = run.scan_history(keys=["step", "loss", "alive peers", "_timestamp"])
16
 
17
  steps = []
18
  losses = []
19
  alive_peers = []
20
+ dates = []
21
  for row in history:
22
  steps.append(row["step"])
23
  losses.append(row["loss"])
24
  alive_peers.append(row["alive peers"])
25
+ dates.append(datetime.datetime.utcfromtimestamp(row["_timestamp"]))
26
 
27
+ return steps, dates, losses, alive_peers