Wandb.watch with pytorch not logging anything


I am trying to use wandb.watch for a pytorch model, unfortunately without success. I checked the documentation and these two threads:

  • Wandb.watch not logging parameters
  • When is one supposed to run wandb.watch so that weights and biases tracks params and gradients?

But none of the suggested solutions solves my problem. I run in my environment the code from the colab notebook linked in this post (with N, log_freq = 50, 2) and still nothing is logged.

Interestingly, if I set the log_graph=True there is a JSON file logged as a file, under root / media / graph in the files section. But I was expecting to get a result similar to this.

I am using wandb version 0.12.10.

Kind regards,

Hi Maciej,

Thank you for writing in and for doing as much research on your own as you can for this issue.

In the colab that you had mentioned with the changed parameters that you used, I as able to log parameters properly. Here’s the run that I used with N, log_freq = 50, 2. Can you send me a link of the run page where you are experiencing this issue? Also, can you try rerunning this using CLI-0.12.11 and see if that is able to help?



Eureka! Everything was working correctly, but I always use wandb.ai with project view or run groups view. When I opened the run view both the graph and gradient were there :slight_smile:

However, there is one problem remaining: parameters. When running the colab notebook code with wandb.watch(d, log_freq=log_freq, log="all") I still can see only gradients in the run view.

Link to run page executed with wandb version 0.12.11 in Google Colab.

EDIT: I found it :slight_smile: Code in the notebook was using forward() instead of __call__(). Forward hooks were not executed.

Yay! That’s great! I’m glad you were able to find out what was wrong with your script :slight_smile: I hope you have a beautiful week

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.