tianshou icon indicating copy to clipboard operation
tianshou copied to clipboard

Question of logging

Open SoMuchSerenity opened this issue 2 years ago • 1 comments

  • [ ] I have marked all applicable categories:
    • [ ] exception-raising bug
    • [ ] RL algorithm bug
    • [ ] documentation request (i.e. "X is missing from the documentation.")
    • [ ] new feature request
  • [X] I have visited the source website
  • [X] I have searched through the issue tracker for duplicates
  • [X] I have mentioned version numbers, operating system and environment, where applicable:
    import tianshou, gym, torch, numpy, sys
    print(tianshou.__version__, gym.__version__, torch.__version__, numpy.__version__, sys.version, sys.platform)
    

Hi Jiayi,

I tried to log my training statistics but saw incomplete information logged.

Epoch #1: 222it [02:03,  1.79it/s, env_step=222, len=30, loss=89340.694, loss/clip=0.045, loss/ent=-2.488, loss/vf=178681.249, n/ep=1, n/st=30, rew=2223.09]                         
Epoch #2: 219it [01:38,  2.22it/s, env_step=441, len=32, loss=76649.988, loss/clip=0.070, loss/ent=-4.043, loss/vf=153299.755, n/ep=1, n/st=32, rew=1881.12]                         
Epoch #3: 228it [01:28,  2.59it/s, env_step=669, len=30, loss=91553.552, loss/clip=0.072, loss/ent=-4.119, loss/vf=183106.875, n/ep=1, n/st=30, rew=1249.17]                         
Epoch #4: 327it [01:54,  2.86it/s, env_step=996, len=157, loss=75944.750, loss/clip=0.078, loss/ent=-4.771, loss/vf=151889.246, n/ep=1, n/st=157, rew=908.29]                        
Epoch #5: 221it [01:52,  1.97it/s, env_step=1217, len=46, loss=66637.170, loss/clip=0.080, loss/ent=-5.353, loss/vf=133274.072, n/ep=1, n/st=46, rew=1687.17]                           
Epoch #6: 236it [02:22,  1.66it/s, env_step=1453, len=50, loss=90272.582, loss/clip=0.091, loss/ent=-4.729, loss/vf=180544.883, n/ep=1, n/st=50, rew=389.95]                           
Epoch #7: 213it [01:59,  1.78it/s, env_step=1666, len=49, loss=82984.847, loss/clip=0.096, loss/ent=-4.390, loss/vf=165969.410, n/ep=1, n/st=49, rew=-27.73]                         
Epoch #8: 215it [02:05,  1.71it/s, env_step=1881, len=35, loss=77680.648, loss/clip=0.093, loss/ent=-4.032, loss/vf=155361.026, n/ep=1, n/st=35, rew=1345.47]                          
Epoch #9: 212it [02:10,  1.62it/s, env_step=2093, len=38, loss=72655.930, loss/clip=0.098, loss/ent=-3.698, loss/vf=145311.587, n/ep=1, n/st=38, rew=2980.62]                         
Epoch #10: 248it [02:12,  1.88it/s, env_step=2341, len=87, loss=70633.569, loss/clip=0.098, loss/ent=-3.488, loss/vf=141266.870, n/ep=1, n/st=87, rew=3677.44] 

When viewed on Tensorboard, it is like this: tensorboard The axis is not in the correct position either. I set the logger as in the tutorial. Any idea how to I can record the statistics from every epoch? Thanks!

SoMuchSerenity avatar Aug 04 '22 18:08 SoMuchSerenity

Have you tried setting train_interval = 1 in TensorboardLogger? https://github.com/thu-ml/tianshou/blob/0f59e38b126f7fb7696b79e53c86cd7b321550cb/tianshou/utils/logger/base.py#L15

Trinkle23897 avatar Aug 04 '22 21:08 Trinkle23897