-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Base class for models #4569
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
Comments
I think it's a reasonable idea that will provide structure on the API of models. I assume only the main classes of the models will implement this API, not submodules like |
In my opinion, if there's not much functionality that's best inherited (e.g. |
That would be nice but it might be hard to sell and take a very long time to coordinate.
I agree with this. The only reason to introduce such an object would be to throw an An additional issue that ties with both your points and my earlier comment is, what happens with submodules like |
About submodules and recursiveness, there are similar discussions going on in the main repo: pytorch/pytorch#66317 / pytorch/pytorch#65153 With respect to recursiveness, IMO at least there should be a method at the highest level (i.e. the model), and then if makes sense it could move init code to submodules. This already should allow starting unification of init code under a single name |
I agree that we should avoid unnecessary inheritance so that the implementation is more readable. I open this issue to gather generic functionalities that should be applied to all models. should submodules implement the
Is there a need to initialize the submodule differently in real world? otherwise, I would recommend only the main class should implement the |
I think I would maybe do a step back and consider what functionality we would want to have in a base I agree with @vadimkantorov that it might be best to keep things as simple as possible. An example of base inheritance making things harder for the user is the Without some strong need for a base class, I would lean towards keeping everything basic |
@kazhang Thanks for the clarifications. Agreed.
Good idea, worth discussing. Since there seems that there is not enough generic functionalities to be shared across models and there is agreement to avoid introducing unnecessary complexity, does it mean we can close the issue? |
Let's close this issue for now until we find strong enough feature set to be added to a generic top-level class. |
Uh oh!
There was an error while loading. Please reload this page.
🚀 The feature
Introduce a base class for all TorchVision models. The base class defines common interfaces and attributes.
Motivation, pitch
We can track the model instantiation similar to dataset instantiation.
We can also define a
reset_parameters
interface to address #3410.Alternatives
Adding logging and
reset_parameters
to each of the models manually. The approach is not future proof, we might forget to do that for new models.Additional context
No response
cc @datumbox
The text was updated successfully, but these errors were encountered: