-
Couldn't load subscription status.
- Fork 6.5k
[Tests] Adds a test suite for EMAModel
#2530
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
tests/test_ema.py
Outdated
| ema_unet.step(unet.parameters()) | ||
| assert ema_unet.optimization_step == 3 | ||
|
|
||
| del unet, ema_unet |
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.
we shouldn't ever really manually call del on variables unless we absolutely need to force a garbage collection on a variable that is still in scope or for some reason the python garbage collector can't handle its de-allocation (I think this is sometimes the case if we have reference cycles).
In the case of these tests where we create the models at the beginning of the test and they fall out of scope at the end of the test, it looks like they're pretty straight forward for allocation and de-allocation and we shouldn't need to manually call del.
If I'm missing something and the ema class breaks python's gc and we do need to manually call del, it would be nice if we could instead fix the ema class.
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.
Makes sense! Keeping this comment open as it's useful discussion.
|
looks good! can we also test the serialization methods? |
Co-authored-by: Will Berman <wlbberman@gmail.com>
Done. |
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.
Super nice! Thanks for adding the tests
|
From this action: I can add Could you advise? |
|
@sayakpaul We don't support training on mps so just skip it 👍 |
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.
perfect!
|
Will merge after the CI has run. |
* ema test cases. * debugging maessages. * debugging maessages. * add: tests for ema. * fix: optimization_step arg, * handle device placement. * Apply suggestions from code review Co-authored-by: Will Berman <wlbberman@gmail.com> * remove del and gc. * address PR feedback. * add: tests for serialization. * fix: typos. * skip_mps to serialization. --------- Co-authored-by: Will Berman <wlbberman@gmail.com> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
* ema test cases. * debugging maessages. * debugging maessages. * add: tests for ema. * fix: optimization_step arg, * handle device placement. * Apply suggestions from code review Co-authored-by: Will Berman <wlbberman@gmail.com> * remove del and gc. * address PR feedback. * add: tests for serialization. * fix: typos. * skip_mps to serialization. --------- Co-authored-by: Will Berman <wlbberman@gmail.com> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Closes #2377