# Wandb.watch not logging parameters

**URL:** <https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197>\
**Category:** W&B Help\
**Created:** [November 2, 2021, 2:31pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197 "2021-11-02T14:31:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [November 2, 2021, 2:31pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/1 "2021-11-02T14:31:08Z")

</div>

I just started to use w&b to monitor the training of my few-shot learning NNs in Pytorch. I use wandb.watch(model, log=‘all’) but it only logs the gradients. Any idea what could be causing this? Also, is there an easy way to log the activation histograms of the different layers for pytorch?

Thanks!

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [November 3, 2021, 2:20pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/2 "2021-11-03T14:20:17Z")

</div>

Hi Nora, that is an interesting bug. The default is to log gradients. Can you try putting “all” in double quotes instead of single quotes?

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [November 3, 2021, 4:22pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/3 "2021-11-03T16:22:39Z")

</div>

Hi Leslie,

Thanks for the reply. Unfortunately, the double quotes didn’t change the result, still only gradients. When I put ‘parameters’ nothing is logged.

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [November 4, 2021, 3:23pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/4 "2021-11-04T15:23:53Z")

</div>

Can you tell me what version of wandb you’re using?

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [November 5, 2021, 9:10am UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/5 "2021-11-05T09:10:05Z")

</div>

I recently installed it, version is wandb 0.12.5.

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [November 15, 2021, 3:48pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/6 "2021-11-15T15:48:59Z")

</div>

Are you using wandb.log in your code?

---

<div class="post-metadata">

**Author:** ![anmolmann](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@anmolmann](https://community.wandb.ai/u/anmolmann)\
**Post date:** [November 15, 2021, 5:28pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/7 "2021-11-15T17:28:52Z")

</div>

@norav , you might want to make sure if you’re logging at least one piece of data with `wandb.log()` **first**. Also, it would be worth mentioning that we only log gradients every 1000 steps by default.

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [November 18, 2021, 4:52pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/8 "2021-11-18T16:52:07Z")

</div>

Hi Nora, we wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [November 19, 2021, 9:52am UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/9 "2021-11-19T09:52:31Z")

</div>

Hi Leslie,

The issue has not been resolved. I do use wandb.log() in my code for the loss and I use it now as well to log the parameters using hooks. I’m afraid this slows down my code but see no other solution since wandb.watch() is only logging gradients.

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [November 22, 2021, 4:36pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/10 "2021-11-22T16:36:24Z")

</div>

Can you let us know how many steps you are running?

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [November 25, 2021, 11:43am UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/11 "2021-11-25T11:43:13Z")

</div>

I am running 50-100 steps. I use the command watch(model, log=‘all’, log\_freq=1)

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [December 1, 2021, 7:34pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/12 "2021-12-01T19:34:21Z")

</div>

Can you send an image of what you see on your dashboard as to what is appearing and give us a script of how you are implementing wandb.log into your code?

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [December 2, 2021, 3:40pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/13 "2021-12-02T15:40:54Z")

</div>

![panelwb](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/17f2c16284d2751c60649611a962c64992e1497e.png)  
This is the dashboard where I only get the gradients, not the parameters.

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [December 2, 2021, 3:42pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/14 "2021-12-02T15:42:55Z")

</div>

![wan](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/363b37aefcf9ef3c5681e1df6a1a3f8c1ef0c5c2.png)

Here I initialize the wandb run and I pass it to the train functino (wrapper.fit()) where I log the loss with the next code snippet

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [December 2, 2021, 3:43pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/15 "2021-12-02T15:43:27Z")

</div>

![loggingwb](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/86e52e1bb508b59925192897385b870cd9694f8b.png)

---

<div class="post-metadata">

**Author:** ![lesliewandb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/lesliewandb/32/369_2.png) [@lesliewandb](https://community.wandb.ai/u/lesliewandb)\
**Post date:** [December 3, 2021, 5:37pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/16 "2021-12-03T17:37:11Z")

</div>

Can you use wandb.log once before you use wanbd.watch? Wandb.watch won’t work properly if wandb.log is not there beforehand

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [December 6, 2021, 1:09pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/17 "2021-12-06T13:09:36Z")

</div>

Still no parameters with logging something before the watch:  
run.log({‘trainidx’:trainidx})  
run.watch(model, log='all, log\_freq=1)

---

<div class="post-metadata">

**Author:** ![anmolmann](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@anmolmann](https://community.wandb.ai/u/anmolmann)\
**Post date:** [December 6, 2021, 8:07pm UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/19 "2021-12-06T20:07:23Z")

</div>

@norav , is there any chance you’re calling `model.forward(inputs)` instead of `model(inputs)`? Also, if you could share your script, that would be very helpful to reproduce the issue.

---

<div class="post-metadata">

**Author:** ![norav](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@norav](https://community.wandb.ai/u/norav)\
**Post date:** [December 7, 2021, 10:24am UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/20 "2021-12-07T10:24:01Z")

</div>

Yes this seems to be it. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [February 5, 2022, 10:24am UTC](https://community.wandb.ai/t/wandb-watch-not-logging-parameters/1197/21 "2022-02-05T10:24:20Z")

</div>

Closed on February 5, 2022, 10:24am UTC

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