When using wandb lib within huggingface lib, I assign the runname in the running script and wandb create a run in the webpage according to the name, but when the code also create a randomly named file in the local and the code would try to open the local file. What should I do to align the both?
1 Like
Your setup
Your wandb.init() setup creates an empty log name at the beginning. After renaming it, it will show as the new name in the script log output, while the name at wandb.finish() time was alright anyway.
wandb.init() # → random log output name
# ...
wandb.run.name = MYLOGNAME
# ...
wandb.finish() # → right log output name
Needed setup
You need to start with wandb.init(name=MYLOGNAME) to avoid the random name in the output of the script. I guess wandb logs also write to a directory in the wandb logs at the time of wandb.init(). By assigning the name at the beginning, you do not need to write wandb.run.name = MYLOGNAME afterwards anymore.
init(name=MYLOGNAME) # → right log output name (no worries, no empty run will pop up in Weights & Biases frontend unless you pass more parameters)
# ...
wandb.finish() # → right log output name
Avoid an empty run from wandb.init(…)
Mind that you might create an empty run in the Weights & Biases frontend. If you also pass project, entity and name at wandb.init()time, you will see a needless empty run in the wandb frontend.
1 Like