Skip to content

[feature] Add --initialize-from option #3710

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

Merged
merged 31 commits into from
Apr 3, 2020
Merged

[feature] Add --initialize-from option #3710

merged 31 commits into from
Apr 3, 2020

Conversation

ervteng
Copy link
Contributor

@ervteng ervteng commented Mar 30, 2020

Proposed change(s)

Often-asked for feature. This PR adds a new CLI option, --initialize-from=<run-id>, that allows a user to specify an old run ID. This will load the weights of the old run ID, but start training from step 0 to the newly specified --run-id=<run-id>. This can be used, e.g. for fine-tuning an existing model on a new environment/reward function.

Note that combining with --resume will load the old model, save to the new run-id, but resume training from the step count of the old model.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

See: https://forum.unity.com/threads/ml-agents-train-an-already-trained-model.840892/

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)
  • Updated the migration guide (if applicable)

@ervteng ervteng requested review from harperj and andrewcoh March 30, 2020 23:48
Copy link
Contributor

@harperj harperj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, had a few small discussion points / suggestions

Copy link
Contributor

@harperj harperj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ervteng ervteng merged commit e875ba2 into master Apr 3, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-initfrom branch April 3, 2020 00:27
@teelrc
Copy link

teelrc commented May 13, 2020

Hey @ervteng I believe there may be a bug in this PR where the step isn't being reset to zero when using --initialize-from and instead it just resumes from where the model you initialized left off. I created the bug below with repro steps:

#3956

@ervteng
Copy link
Contributor Author

ervteng commented May 13, 2020

Hi @teelrc, this is indeed a bug and will be fixed soon. If you want to fix it yourself in the meantime, adding self._set_step(0) at line 141 in tf_policy.py will fix the issue. Thanks for reporting it!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants