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.

[Question] WandB logging with SubprocVecEnv

See original GitHub issue

Question

Is it possible to perform logging using the WandB callback while using the SubprocVecEnv? I tried but I am encountering errors, so I’d like to know if you already tried this.

Additional context

If I create a run for each different environment in a subprocess (basically call wand.init inside the env), I get the following error AssertionError: daemonic processes are not allowed to have children

However, if I create one single run and perform the logging in the subprocesses, I get a different error (basically the PID of the process initializing the run and the PID of the processes performing the logs are different)

Checklist

  • I have read the documentation (required)
  • I have checked that there is no similar issue in the repo (required)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
araffincommented, Apr 11, 2022

I should call init in each subprocess, right?

I don’t think so, callback is in the main thread, not in the subprocesses. Closing as the issue is related to W&B, not SB3, and as the W&B works fine in the RL Zoo with multiple envs (and with subprocesses). See for instance https://wandb.ai/openrlbenchmark/sb3/runs/2tf89ihi?workspace=user-araffin

0reactions
tfedericocommented, Mar 23, 2022

From what I understood from the WandB documentation, it is one of the 2 options for multiprocessing (call initin all your processes).

So if I use SubprocVecEnv and create a subprocess for each env, I should call init in each subprocess, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with gym video logging #1141 - GitHub
SubprocVecEnv is a common module from openai/baselines ... However, this causes issues for wandb video logging.
Read more >
Stable Baselines 3 - Documentation - Weights & Biases - Wandb
Stable Baselines 3 · Record metrics such as losses and episodic returns · Upload videos of agents playing the games · Save the...
Read more >
Stable-Baselines3 log rewards - python - Stack Overflow
You can access the local variables available to the logger callback using self.locals . Any variables exposed in your custom environment ...
Read more >
Using Weights & Biases with Tune - the Ray documentation
log () to log your training process. Running A Weights & Biases Example. Tune Wandb API Reference. WandbLoggerCallback. Wandb-Mixin ...
Read more >
Brief Introduction to Logging with Weights & Biases
wandb.log is a function that we use for logging. You can log almost everything you can ... Using W&B, you can easily diagnose...
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