tcapelle commited on
Commit
ad144d3
1 Parent(s): bee3b6e

improve pbar

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. utils.py +2 -1
app.py CHANGED
@@ -50,8 +50,8 @@ sb.write(pseudo_code)
50
 
51
  # train model
52
  if sb.button("Run Example"):
53
- my_bar = sb.progress(0)
54
  print("Running training")
55
  for i in range(runs):
56
- train(project=project, entity=entity, epochs=epochs)
57
- my_bar.progress((i+1)/runs)
 
50
 
51
  # train model
52
  if sb.button("Run Example"):
53
+
54
  print("Running training")
55
  for i in range(runs):
56
+ my_bar = sb.progress(0)
57
+ train(project=project, entity=entity, epochs=epochs, bar=my_bar)
utils.py CHANGED
@@ -3,7 +3,7 @@ import random, time
3
  import wandb
4
 
5
 
6
- def train(project="st", entity=None, epochs=10):
7
  run = wandb.init(
8
  # Set the project where this run will be logged
9
  project=project,
@@ -24,6 +24,7 @@ def train(project="st", entity=None, epochs=10):
24
  # 2️⃣ Log metrics from your script to W&B
25
  wandb.log({"acc": acc, "loss": loss})
26
  time.sleep(0.1)
 
27
 
28
  # Mark the run as finished
29
  wandb.finish()
 
3
  import wandb
4
 
5
 
6
+ def train(project="st", entity=None, epochs=10, bar=None):
7
  run = wandb.init(
8
  # Set the project where this run will be logged
9
  project=project,
 
24
  # 2️⃣ Log metrics from your script to W&B
25
  wandb.log({"acc": acc, "loss": loss})
26
  time.sleep(0.1)
27
+ bar.progress(epoch/epochs)
28
 
29
  # Mark the run as finished
30
  wandb.finish()