takuseno / d3rlpy

An offline deep reinforcement learning library

Home Page:https://takuseno.github.io/d3rlpy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION] Logging metrics at every step of training

NicholasCL1994 opened this issue · comments

Hello, @takuseno! First I would like to congratulate you on this package!

By default, it saves the last step of every epoch in the csv file of a given metric, but I would like to keep record of the metrics every step of training while using .fit() (I am doing offline RL). I have being through the docs extensively but could not find a way to achieve what I am looking for.

Best,

@NicholasCL1994 Thanks for the issue and sorry for the late response. Currently, it's not directly supported. However, you can create a custom logger to achieve your goal.

References are here:

Thanks for the reply! I have tried to use the custom logger but in fitter(), the function commit(), which as I understood correctly saves the metrics into the csv file, is only called in the outside loop (for the epochs) and not inside the training loop. So I don't see how a custom logger would allow me to save the metrics at every training step. Sorry if I missed something.

Sorry for being late to respond. Recently, logging_strategy option has been added to fit method. If you do as follows, you can save metrics every steps:

import d3rlpy
from d3rlpy.constants import LoggingStrategy

dqn = d3rlpy.algos.DQNConfig.create()
dqn.fit(..., logging_strategy=LoggingStrategy.STEPS, logging_steps=1)

Please make sure that you install v2.4.0 package or latest source code.

Thanks! I really appreciate all the help, @takuseno !

Feel free to reopen this issue if there is any further discussion.