-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No metrics logged when using wandb integrations of sb3 #212
Comments
I also notice that in the process of learning, log information seems not to be printed or saved. |
I guess there is some problems with the using of logger, I am a littled confused, looking forward to your help. |
Hey @XiaobenLi00. Thanks for the question. I defined the tensorboard_log directory to be within the wandb folder, and that fixed things for me. I now see metrics within the wandb app where I didn't before. Specifically, when instantiating the PPO (or SAC) model in sb3_job_script.py, I included Does this work for you? |
@jamesheald Thanks a lot for your reply, this seems work for me. |
I am also wondering that is it OK to call |
I also find that the num of steps is small, how should I to adjust this? |
The monitor_gym flag automatically logs videos that are generated, but videos need to be generated by another process, such as VideoRecorderCallback (which you tried) or an environment wrapper like VecVideoRecorder. The problem is that both of these methods expect the gym environment to have an env.render() function, and the myosuite gym environments don't have this function; in myosuite, env.mj_render() is used for onscreen rendering and env.sim.renderer.render_offscreen() is used for offscreen rendering. You may be able to create a gym wrapper that allows you to use VideoRecorderCallback or VecVideoRecorder. Alternatively you can manually save videos, as shown in the tutorial here.
If you're using the provided config files, https://github.com/MyoHub/myosuite/tree/main/myosuite/agents/config, you can adjust it there, or alternatively you can specify it directly as an argument to model.learn, for example:
|
@jamesheald Thank you very much indeed for your answer! I have understood how to record videos by defining wrapper and I will try. I did have a problem which is not related to this issue very much. I am wondering what In my exp, I use callback += [EvalCallback(max(job_data.eval_freq // job_data.n_env, 1), eval_env)]
callback += [InfoCallback()]
callback += [FallbackCheckpoint(max(job_data.restore_checkpoint_freq // job_data.n_env, 1))]
callback += [CheckpointCallback(save_freq=max(job_data.save_freq // job_data.n_env, 1), save_path=f'logs/',
name_prefix='rl_models')]
# callback += [VideoRecorderCallback(eval_env, render_freq=max(job_data.render_freq // job_data.n_env, 1))] and config # PPO.learn function
total_timesteps : 2000000
log_interval : 10000
render_freq : 100000
eval_freq : 100000
restore_checkpoint_freq : 100000
save_freq : 100000 Then I got logs in wandb like this: |
Hi, You should change the x-axis to global steps to sync to the training steps. I suggest you reading the SB3 training documentations for more information on the use of each parameter: https://stable-baselines3.readthedocs.io/en/master/modules/ppo.html |
Thanks a lot for your kind help! |
For rendering videos, this simple environment wrapper makes VideoRecorderCallback and VecVideoRecorder compatible with myosuite environments:
|
When I run sb3_job_script https://github.com/MyoHub/myosuite/blob/main/myosuite/agents/sb3_job_script.py using wandb integrations, it didn't report a warning or error, but in the wandb website there is no metrics logged.
I tried with other framework, e.g., torchrl_job_script https://github.com/MyoHub/myosuite/blob/main/myosuite/agents/torchrl_job_script.py, and the metrics could be logged.
I am not sure where the problem come from, so could you help to figure out?
The text was updated successfully, but these errors were encountered: