question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wandb.watch(model): unwatch and rewatch models with new parameters, using Hugging Face

See original GitHub issue

wandb --version && python --version && uname

wandb, version 0.9.3 Python 3.6.8 :: Anaconda, Inc. Darwin

Description

I was trying to unwatch models and rewatch them with new parameters. I am using the huggingface library which uses wandb.

What I Did

wandb.unwatch()
self._setup_wandb()

self._setup_wandb() is defined basically as:


wandb.watch(
                   self.model, log=os.getenv("WANDB_WATCH", "gradients"), log_freq=max(100, self.args.logging_steps)
               )

Now, looking into unwatch/unhook in the wandb code:

 def unhook_all(self):
       for handle in self._hook_handles.values():
           handle.remove()
       self._hook_handles = []


   def unhook(self, name):
       handle = self._hook_handles.pop(name)
       handle.remove()

This is wrong, it seems that at some point self._hook_handles was changed to a dictionary, so unhook/unhook all should be something like:

 def unhook_all(self):
       for handle in self._hook_handles.values():
           handle.remove()
       self._hook_handles = {}


   def unhook(self, name):
       handle = self._hook_handles[name]
       handle.remove()

I havent tried this yet but I’ll get back to it if I do.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
borisdaymacommented, Jul 21, 2020

I can confirm issues with wandb.unwatch method. Maybe we should wait for the new CLI?

1reaction
cvphelpscommented, Jul 21, 2020

Hi Pedro, thanks for diving in to the wandb.watch() code, @borisdayma could you take a look?

As for un-watching and re-watching a model, it sounds like you’re editing the model during training, is that right? I’d recommend calling wandb.init() to start a new run each time you want to watch a model with new parameters

Read more comments on GitHub >

github_iconTop Results From Across the Web

wandb.watch(model): unwatch and rewatch models with new ...
I was trying to unwatch models and rewatch them with new parameters. I am using the huggingface library which uses wandb.
Read more >
wandb.watch - Documentation - Weights & Biases
Hooks into the torch model to collect gradients and the topology. watch(. models,. criterion=None,. log: Optional[Literal['gradients', 'parameters', ...
Read more >
Logging & Experiment tracking with W&B - Transformers
For people interested in tools for logging and comparing different models and training runs in general, Weights & Biases is directly ...
Read more >
Simple index - piwheels
... command-line-blog bookery p01-dashboard proxycrawl markings mypy-boto3-servicecatalog-appregistry kilroy-module-huggingface sage-acsv devops-toolset fax ...
Read more >
imdb.vocab - Department of Statistics and Data Science
the and a of to is it in i this that was as for with movie but film on not you ... too...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found