0

The following code should loop 3 times. It works three times in Jupyter notbook but only once in VSC. Weird.

import wandb
N_EPOCHS=10
batch_size=16
from tqdm import tqdm 
for eachtime in tqdm(range(3)):
     
    wandb.init(project='test',name='TESTWANDB'+'_'+str(eachtime))
    wandb.config = {
                "epochs": N_EPOCHS,
                "batch_size": batch_size
                }
gggg
  • 15
  • 3

1 Answers1

1

If you'd like to each init call to create a new run, you should call wandb.finish() and that'll explicitly end that run, then you can call wandb.init again to start a new run.

Scott Condron
  • 1,902
  • 16
  • 20
  • Thx. Then Why I donot need this step in Jupyter Notebook? – gggg Jan 25 '22 at 15:40
  • This is a known difference in behaviour and we're looking into it. In the meantime, if you want the same behaviour outside of Jupyter, you can pass in `reinit=True` to `wandb.init` and it will create a new run every time `wandb.init` is called. – Scott Condron Feb 03 '22 at 19:05