'wandb loops work differently between Jupyter Notebook and Microsoft Visual Studio Code (Pyhton3)

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
                }


Solution 1:[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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Scott Condron