-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Refactor the get_weights
API
#5006
Refactor the get_weights
API
#5006
Conversation
💊 CI failures summary and remediationsAs of commit 6d0cc8e (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
06ec3ca
to
fdc9d2a
Compare
fdc9d2a
to
5c0ec62
Compare
5c0ec62
to
3339918
Compare
The references were validated by running the following commands. All work as expected:
|
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 @datumbox , I made some minor comments and a question, but this LGTM
@@ -78,41 +84,37 @@ def __getattr__(self, name): | |||
return super().__getattr__(name) | |||
|
|||
|
|||
def get_weight(fn: Callable, weight_name: str) -> WeightsEnum: | |||
def get_weight(name: str) -> WeightsEnum: |
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'm wondering: shoudn't this return a Weight
instance, instead of WeightsEnum
?
Same for from_str
(and in the return section below).
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 think we need to return a WeightsEnum
value. That is the value of an Enum which maintains information about the class it comes from (ResNet50_Weights
). Returning a Weights
loses the information necessary to validate that the right type of weights were passed to the method.
Summary: * Change the `default` weights mechanism to sue Enum aliases. * Change `get_weights` to work with full Enum names and make it public. * Applying improvements from code review. Reviewed By: NicolasHug Differential Revision: D32759199 fbshipit-source-id: 13cfa6201125db29f099d2e3a73260d62341a205
Fixes #4652
default
weights mechanism to sue Enum aliases.get_weights
to work with full Enum names and make it public.cc @datumbox @bjuncek