thu-ml / tianshou

An elegant PyTorch deep reinforcement learning library.
https://tianshou.org
MIT License
7.73k stars 1.11k forks source link

Is it possible to customize the logger to record some specific parameters? #977

Open zichunxx opened 10 months ago

zichunxx commented 10 months ago
0.5.1 0.29.1 1.12.1 1.24.4 3.9.17 | packaged by conda-forge | (main, Aug 10 2023, 07:02:31) 
[GCC 12.3.0] linux

Hi!

I want to customize a logger to record some desired parameters, like success rate.

I'm trying to get to know the Tianshou API, but I'm not sure if it is easy to implement. Or, are there any examples to be referred to?

I have trained some Mujoco example models. Only these parameters are recorded, such as env_step, length, length_std, test/train reward, etc.

If this is unavailable for the current version of Tianshou? Would it be considered a new feature to record the variation of the success rate during training?

Thanks in advance!

MischaPanch commented 10 months ago

This will likely be addressed by closing #895 and #933. Would you like to help with these? Otherwise, I think I will start working on them quite soon (maybe around end of November), as they are rather high on the priority list

MischaPanch commented 10 months ago

Could you specify what exactly you mean by variation of success rate? @STAY-Melody

zichunxx commented 10 months ago

I want to test the success rate of the current model at certain intervals, e.g., 1e4, during training, which can be achieved by several random test rollouts. In this way, variations in the success rate during training can be recorded. Here is the function that encapsulates what I mean.

MischaPanch commented 7 months ago

We now have dataclasses as returns almost everywhere instead of the previous dicts, so now callbacks can be written. @maxhuettenrauch and I will have a look at this and likely implement soon