[ENH] Implementing the iTransformer model in PTFv2.#1994
[ENH] Implementing the iTransformer model in PTFv2.#1994JATAYU000 wants to merge 13 commits intosktime:mainfrom
iTransformer model in PTFv2.#1994Conversation
PranavBhatP
left a comment
There was a problem hiding this comment.
Thanks for the PR @JATAYU000 . I've dropped some comments on the PR.
There was a problem hiding this comment.
Conventionally for v2, all the layers of the models' architecture are present in the layers directory. Many of the layers you are using here can be directly imported from this directory, I see a lot of commonality. I would suggest only adding new layers (if not already present in layers) as a subdirectory - layers/_<layer-type>. sub_modules.py is a v1 convention
There was a problem hiding this comment.
I found some changes in some layers and let it be in submodules for now in draft pr, will fix this .
| :, :, :N | ||
| ] # filter covariates | ||
|
|
||
| if self.use_norm: |
There was a problem hiding this comment.
self.use_norm is not required in the model code since it will be handled by the D1/D2 layers. Normalization and denomalization need not be handled here. Simply return dec_out.
There was a problem hiding this comment.
Oh Thank you for pointing that out.
| } | ||
|
|
||
| @classmethod | ||
| def get_test_train_params(cls): |
There was a problem hiding this comment.
Can you add a few more test cases here?
| """ | ||
| An implementation of iTransformer model for v2 of pytorch-forecasting. | ||
|
|
||
| Parameters |
There was a problem hiding this comment.
Docstring for model hyperparameters is missing.
@PranavBhatP The |
|
re layers, I would do as follows:
|
@fkiraly seems like a nice good first issue? |
|
@JATAYU000 any hurdles with fixing issues in the PR? |
|
@PranavBhatP There are'nt any hurdles, I was busy with some other projects, I needed a review on the model and layer implementation since it updates the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1994 +/- ##
=======================================
Coverage ? 86.77%
=======================================
Files ? 168
Lines ? 9817
Branches ? 0
=======================================
Hits ? 8519
Misses ? 1298
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| """ | ||
| Encoder module for the TimeXer model. | ||
| Encoder module for Tslib models. | ||
| Args: |
There was a problem hiding this comment.
please change this to numpydoc style docstring
| """ | ||
| Encoder layer for the TimeXer model. | ||
| Encoder layer for TsLib models. | ||
| Args: |
There was a problem hiding this comment.
please change this to numpydoc style docstring
| {}, | ||
| dict(d_model=16, n_heads=2, e_layers=2, d_ff=64), | ||
| dict( | ||
| d_model=32, |
There was a problem hiding this comment.
should we try one param with output_attetion=True as well? to cover all possibilities?
phoeenniixx
left a comment
There was a problem hiding this comment.
Thanks @JATAYU000 ! I think it is almost ready. Just few comments and suggestions.
FYI @agobbifbk, @PranavBhatP
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1994 +/- ##
=======================================
Coverage ? 86.77%
=======================================
Files ? 168
Lines ? 9817
Branches ? 0
=======================================
Hits ? 8519
Misses ? 1298
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This is misleading, timestamp are not processed by this layer :-) enc_out = self.enc_embedding(x_enc, x_mark_enc) # covariates (e.g timestamp) Moreover here I don't see any reference to the crossattention self.encoder = Encoder(
[
EncoderLayer(
self_attention=AttentionLayer(
FullAttention(
False,
self.factor,
attention_dropout=self.dropout,
output_attention=True,
),
self.d_model,
self.n_heads,
),
d_model=self.d_model,
d_ff=self.d_ff,
dropout=self.dropout,
activation=self.activation,
output_attention=True,
)
for _ in range(self.e_layers)
],
norm_layer=torch.nn.LayerNorm(self.d_model),
output_attention=True,
)
if self.n_quantiles is not None:
self.projector = nn.Linear(
self.d_model, self.prediction_length * self.n_quantiles, bias=True
)
else:
self.projector = nn.Linear(self.d_model, self.prediction_length, bias=True)the Encoder layer has crossattention None by default How the user can use this? Or I'm missing something? |
The comment was cut, it was supposed to be
If there is any other reason to not to default to None? I did not understand the exact problem could you please elaborate a bit more @agobbifbk |
Reference Issues/PRs
Fixes #1899
What does this implement/fix? Explain your changes.
Have started interfacing
iTransformerin PTFv2, from the TSlib repository thuml/iTransformerWork in progress, would like to have suggestions on it.
What should a reviewer concentrate their feedback on?
Did you add any tests for the change?
Not yet
Any other comments?
PR checklist
pre-commit install.To run hooks independent of commit, execute
pre-commit run --all-files