CRZbulabula commented on code in PR #16923:
URL: https://github.com/apache/iotdb/pull/16923#discussion_r2626750609
##########
iotdb-core/ainode/iotdb/ainode/core/model/sundial/pipeline_sundial.py:
##########
@@ -26,26 +26,36 @@ class SundialPipeline(ForecastPipeline):
def __init__(self, model_info, **model_kwargs):
super().__init__(model_info, model_kwargs=model_kwargs)
- def _preprocess(self, inputs):
- if len(inputs.shape) != 2:
+ def preprocess(self, inputs):
+ """
+ The inputs shape should be 3D, but Sundial only supports 2D tensor:
[batch_size, sequence_length],
+ we need to squeeze the target_count dimension.
+ """
+ inputs = super().preprocess(inputs)
+ if inputs.shape[1] != 1:
raise InferenceModelInternalException(
- f"[Inference] Input shape must be: [batch_size, seq_len], but
receives {inputs.shape}"
+ f"[Inference] Sundial model only supports single target, but
receives {inputs.shape[1]} series."
Review Comment:
```suggestion
f"[Inference] Model sundial only supports univarate
forecast, but receives {inputs.shape[1]} target variables."
```
##########
iotdb-core/ainode/iotdb/ainode/core/model/timer_xl/pipeline_timer.py:
##########
@@ -26,22 +26,31 @@ class TimerPipeline(ForecastPipeline):
def __init__(self, model_info, **model_kwargs):
super().__init__(model_info, model_kwargs=model_kwargs)
- def _preprocess(self, inputs):
- if len(inputs.shape) != 2:
+ def preprocess(self, inputs):
+ """
+ The inputs shape should be 3D, but Timer-XL only supports 2D tensor:
[batch_size, sequence_length],
+ we need to squeeze the target_count dimension.
+ """
+ inputs = super().preprocess(inputs)
+ if inputs.shape[1] != 1:
raise InferenceModelInternalException(
- f"[Inference] Input shape must be: [batch_size, seq_len], but
receives {inputs.shape}"
+ f"[Inference] Timer-XL model only supports single target, but
receives {inputs.shape[1]} series."
Review Comment:
Same as above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]