File size: 762 Bytes
57845b8
 
e638825
3cc58a2
 
e190970
 
11dce67
e638825
3cc58a2
e190970
d9b2598
c0ec2ff
3cc58a2
 
11dce67
57845b8
3cc58a2
 
 
 
57845b8
3cc58a2
 
 
 
57845b8
3cc58a2
57845b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import datetime

import streamlit as st
import wandb

from dashboard_utils.time_tracker import _log, simple_time_tracker

WANDB_RUN_URL = st.secrets["WANDB_RUN_URL_MAIN_METRICS"] 
CACHE_TTL = 100


@st.cache(ttl=CACHE_TTL, show_spinner=False)
@simple_time_tracker(_log)
def get_main_metrics():
    api = wandb.Api()
    run = api.run(WANDB_RUN_URL)
    history = run.scan_history(keys=["step", "loss", "alive peers", "_timestamp"])

    steps = []
    losses = []
    alive_peers = []
    dates = []
    for row in history:
        steps.append(row["step"])
        losses.append(row["loss"])
        alive_peers.append(row["alive peers"])
        dates.append(datetime.datetime.utcfromtimestamp(row["_timestamp"]))

    return steps, dates, losses, alive_peers