Eclectic-Sheep/sheeprl

How to log some values from custom environment?

Closed this issue · 2 comments

Hi! I'm testing sheeprl's dreamer-v3 on my custom environment!

I want to log some values other than just the reward,

but according to dreamer_v3.py, it seems like we can only choose predefined metrics.

I'm wondering if I'm missing sth or there's workaround!

Thanks for beautiful implementation!

Hi @anthony0727,
you are right, dreamerV3 and all the other algorithms log predefined metrics.
However, it is possible to easily add your metric. I would suggest to follow the related howto.
In any case, you must modify the implementation by adding the call to the aggregator.update() function.
Something like this:

if aggregator and not aggregator.disabled:
    aggregator.update("Custom/metric", custom_metric_value)

Note: Remember to update the metric configs and the AGGREGATOR_KEYS variable in the utils.py file of the algorithm.

Got it! Thanks a lot!

FYI we were able to train the dreamerv3 agent on our specific physics related environment with sheeprl!