File size: 1,584 Bytes
c725b52
d247bff
415a2fd
d247bff
415a2fd
c725b52
d247bff
 
 
 
 
 
 
 
 
c725b52
 
 
d247bff
 
 
 
 
 
 
bee3b6e
d247bff
 
c725b52
 
d247bff
 
 
 
c725b52
be81fab
d247bff
 
 
 
 
 
 
c725b52
 
 
 
d247bff
 
 
 
 
be81fab
d247bff
 
ad144d3
d247bff
 
ad144d3
be81fab
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os, random
import wandb
import streamlit as st
import streamlit.components.v1 as components 

from utils import train, WORDS

project = "st"
entity = "capecape"

HEIGHT = 720

def get_project(api, name, entity=None):
    return api.project(name, entity=entity).to_html(height=HEIGHT)

st.title("The wandb Dashboard πŸ‘‡")

run_name = "-".join(random.choices(WORDS, k=2)) + f"-{random.randint(0,100)}"

# Sidebar
sb = st.sidebar
sb.title("Train your model")
# wandb_token = sb.text_input("paste your wandb Api key if you want: https://wandb.ai/authorize", type="password")

# wandb.login(key=wandb_token)
wandb.login(anonymous="must")
api = wandb.Api()

st.success(f"You should see a new run named **{run_name}**, it\'ll have a green circle while it\'s still active")

# render wandb dashboard
components.html(get_project(api, project, entity), height=HEIGHT)

# run params
runs = 1
epochs = sb.slider('Number of epochs:', min_value=100, max_value=500, value=100)


pseudo_code = """
We will execute a simple training loop
```python
wandb.init(project="st", ...)
for i in range(epochs):
  acc = 1 - 2 ** -i - random()
  loss = 2 ** -i + random()
  wandb.log({"acc": acc, 
             "loss": loss})
```
"""

sb.write(pseudo_code)

sb.write("Click πŸ‘‡ to start logging")
# train model
if sb.button("Run Example"):
    
    print("Running training")
    for i in range(runs):
        my_bar = sb.progress(0)
        train(name=run_name, project=project, entity=entity, epochs=epochs, bar=my_bar)

st.subheader("Check our πŸ”₯ [Pytorch Intro colab](https://wandb.me/intro) πŸ”₯")