-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialize-from custom checkpoints #5525
Conversation
if init_path is not None: | ||
trainer_settings.init_path = os.path.join(init_path, brain_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why init_path is passed up to here, was there a specific reason to set this in trainer factory?
I moved this logic to learn.py and if it's harmless will remove the init_path attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried using init_path and see if it does what we expect out of it?
Reading a bit of the code in torch_model_saver.py
it looks like setting init_path in the trainer settings initializes the policy from a checkpoint. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Previously trainer_settings.init_path="result_dir/run_id/brain_name
and we added the checkpoint name at the end in torch_model_saver.py
This PR sets the full path trainer_settings.init_path="result_dir/run_id/brain_name/checkpoint_name.pt
in learn.py:102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some comments.
I would like some clarification on what init_path in the trainer parameters do. It seems a bit redundant with the checkpoint settings.
if init_path is not None: | ||
trainer_settings.init_path = os.path.join(init_path, brain_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried using init_path and see if it does what we expect out of it?
Reading a bit of the code in torch_model_saver.py
it looks like setting init_path in the trainer settings initializes the policy from a checkpoint. Is that correct?
Co-authored-by: Vincent-Pierre BERGES <vincentpierre@unity3d.com>
Co-authored-by: Vincent-Pierre BERGES <vincentpierre@unity3d.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of the code.
Got one question before you merge. If the user fills both init_path and the checkpoint_list. Which one gets priority.
(Please add documentation and changelog before merging)
Co-authored-by: Vincent-Pierre BERGES <vincentpierre@unity3d.com>
* init from any checkpoint including older ones * moving init_path logic ahead to learn.py * fixing pytest to take the full path * doc & changelog
* init from any checkpoint including older ones * moving init_path logic ahead to learn.py * fixing pytest to take the full path * doc & changelog
Proposed change(s)
Initialize from custom checkpoints
Usage:
TODO: Extra tests, Documentation, changeLog
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments