-
Notifications
You must be signed in to change notification settings - Fork 683
[ENH] Restructure codebase: Create separate modules for shared architecture layers. #1835
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
Yes, I agree. My concrete suggestion for layers would be:
For D2 loader modules, I think a top module might also make sense. However, that feels a bit less clear at the moment, because we only have one example currently. I would suggest to defer this to later. |
I also have a suggestion: from pytorch_forecasting.tslib.layers.xyz import abc and for original models from pytorch_forecasting.models.xyz import abc |
@phoeenniixx, sorry to say this, but I strongly disagree with that suggestion. The separation to "tslib" is not architecturally motivated, at least its semantics is not. Plus, it does not scale well in the extension case. Let's say there will be a third bunch of models that use a common D2 layer. Do we just add more and more top level modules for each? I think a separation into models, layers, and "D2" (data loaders?) - or something similar - is the more sensible, architecturally implied division. |
I was thinking a structure like |
That is different, that is a vendor library. It is not architecturally part of The pattern should be avoided in coherent libraries - |
ohh, got it! Thank you for the explanation |
@phoeenniixx, @PranavBhatP, it might be better to do this earlier than later, given that we will be adding new models. Does any of you have capacity currently to take this on - e.g., in a stack with a PR that might add new models? |
Yes @fkiraly, I can work on this once I complete the D2 pipeline for |
@fkiraly, after implementing the layers folder structure, in #1836, I was wondering whether we need to create a "layer" registry to map the layers to the several models they might be used by? It would simplify a layer's visibility to a new user who wants to implement a model and might be searching for a layer similar to his/her requirements. This change is something that can be deferred to later, once #1836 is merged. |
That is a good idea imo, although it needs to be discussed. Primarily, I was thinking of a layer registry not for the purpose of linking layers to models, but for the purpose of carrying metadata, and for the purpose of testing layers individually. The linkage can then easily be reconstructed by lookup and "is part of" operations in I would agree though that we should deal with this after the models. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Currently, each model in
PTF
v1 encapsulates it's set of layers under thesub_modules.py
file. This is prone to duplication of code and ignores the possibility of shared layers used by various model architectures in the present and for those to be implemented in the future.Describe the solution you'd like
Creating a separate module for
layers
and grouping the layers based on functionality is a good step in this direction. Suggestions are welcome. The same logic can be extended to data modules as well, creating a separate folder for implementations of data modules.Additional context
Some references to existing codebases which group layers in such a manner:
https://github.com/Nixtla/neuralforecast/tree/main/neuralforecast
The text was updated successfully, but these errors were encountered: