Closed kaiks closed 1 year ago
@kaiks Thank you for the contribution! I have carefully reviewed the PR. It looks great. I just added some minor comments. Your proposal of modifying evaluate.py
also makes lots of sense. Please consider submitting another PR as well. Have a great day
Hi @daochenzha, thank you for your feedback! I'm glad to hear the change looks useful. I'm not seeing the comments you mentioned. Maybe you forgot to publish the review?
I'll try submit a follow up PR with the discussed changes later - closer to the end of this or next week.
@kaiks Yes, I forgot to publish it. You should be able to see it now.
@daochenzha thanks for the review. I addressed your feedback
@kaiks LGTM, thank you1
This PR introduces checkpoints for RL agents (DQN and NSFP).
Checkpoints are data describing complete agent states (weights and parameters) during training.
To save an agent, you can either set the checkpoint path and save it automatically during training every n training steps. For example, specifying save_path and save_every parameters during agent instantiation:
will save the training progress every 500 steps to a single file.
A complete example of loading an agent looks as follows:
Training can then be resumed or the agent attributes might be inspected or debugged.
Use cases for checkpoints that I can see:
You can also, for instance, save the highest reward agent on every evaluation step when using the
run_rl.py
script by manually saving the agent state:As a next step, it would be possible to streamline loading the models, for instance by extracting and modifying the
load_model
function found in evaluate.py:But this requires more thought and would blow the PR up a bit.
In principle there's nothing stopping us from adding similar serialization for every other agent type and generalizing the loading of saved agent checkpoints.