-
Notifications
You must be signed in to change notification settings - Fork 77
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
[Relax][Training] Optimizer API #107
[Relax][Training] Optimizer API #107
Conversation
5ac0fc7
to
8a59d71
Compare
8a59d71
to
634e6bb
Compare
abf8b03
to
ff37ee8
Compare
ff37ee8
to
3a8b8cd
Compare
|
||
from typing import List, Union | ||
|
||
import numpy as np |
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.
mypy reports error on this line:
error: Cannot find implementation or library stub for module named "numpy"
Now we uses # type: ignore
to suppress the error.
ea1085c
to
96bb1e4
Compare
ce87cf6
to
56ccae2
Compare
Would it be great if we change the name of test files from |
58dd1b1
to
632c455
Compare
Seems I have no access to this repo. |
@MasterJH5574 That repo has been set to public. |
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.
One general comment: should optimizer
be a Python-only data structure or write it with C++?
The main difficulty of putting optimizer in C++ is that optimizers need numpy to construct optimizer states. Now we don't find good utils to construct tensors, like a zeros array with given shape, in C++. |
We have it in Relay and we can make a sperate one for Relax |
5d21473
to
c62a9ba
Compare
- Annotate var names
2dc9b5e
to
b983eaf
Compare
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.
Thanks @Ubospica for the continuous improving
Thank @SiriusNEO @MasterJH5574 @Hzfengsy @spectrometerHBH for the review! |
* fix structural_equal_hash (cherry picked from commit e7e962634999739a32129378f61cc95f58335447) * address comment & pass the ci
* fix structural_equal_hash (cherry picked from commit e7e962634999739a32129378f61cc95f58335447) * address comment & pass the ci
This PR supports the new
relax.training.optimizer.Optimizer
API, which is the abstraction of optimizers in the relax training workflow. Specific optimizers should inherit it and override its methods.See https://github.com/ACMClass-TVM-20/AD-Example/blob/main/optimizer_api_example.py for examples of its usage.
relax.optimizer
is added as an alias forrelax.training.optimizer
.The optimizer would be like:
Now we provide three common optimizers in module
tvm.relax.training.optimizer
: