Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pytorch_forecasting/models/base/_base_model_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
Parameters for the learning rate scheduler.
"""
super().__init__()

# simple check for MultiLoss usage.
if hasattr(loss, "__class__") and loss.__class__.__name__ == "MultiLoss":
warn(

Check warning on line 52 in pytorch_forecasting/models/base/_base_model_v2.py

View check run for this annotation

Codecov / codecov/patch

pytorch_forecasting/models/base/_base_model_v2.py#L52

Added line #L52 was not covered by tests
"\nIMPORTANT: Multi-target forecasting (MultiLoss) is NOT supported "
"in v2 base models. For multi-target forecasting, please use "
"pytorch_forecasting.models.base.BaseModel (v1) instead. "
"Attempting to use MultiLoss with v2 models will result in runtime errors.", # noqa: E501
UserWarning,
stacklevel=2,
)
self.loss = loss
self.logging_metrics = logging_metrics if logging_metrics is not None else []
self.optimizer = optimizer
Expand Down
Loading