Open jrodenberg0 opened 1 month ago
Hey, thanks for reporting. I think this issue is in the wrong repo (should be in NeuralForecast).
To answer though, the Tweedie loss is a bit finicky. I think the error is caused by the return_params=True
- you could try setting that to False
. We've just included a fix on the Tweedie loss on the main branch, but I think that's unrelated to this issue. You could try cloning the main branch of NF and rerunning the script with return_params=False
, that should definitely work.
Let me know if that works for you.
Hi @elephaint, i appreciate you reaching out. Unfortunately after specifying return params== True or False I get the same error.
Did you update to the latest version of Neuralforecast? I can't reproduce the issue.
What happened + What you expected to happen
Attempting to train NBEATsx with NeuralForecast and Tweedie loss and encounter error claiming that "an output must be a tensor, not a tuple")
Versions / Dependencies
neuralforecast 1.7.5
pytorch-forecasting 1.1.1 pytorch-lightning 2.4.0
Reproducible example
from neuralforecast import NeuralForecast
from neuralforecast.models import NHITS, NBEATSx
from neuralforecast.losses.pytorch import DistributionLoss,Tweedie, MSE,MAE,RMSE
import torch
horizon = 13
rho_ = torch.tensor([1.5])#.to('cuda:0') # attempted to take rho to tensor to solve bug, did not work.
cuda = torch.device('cuda')
rho_ = rho.to(cuda)
tweedie_loss = DistributionLoss(distribution='Tweedie',rho=1.2,validate_args=False,return_params=True)
define models here
models = [NBEATSx(h=horizon,
,
nf = NeuralForecast( models=models, freq='W-MON' )
nf_df = df.select('unique_id','Client','Warehouse','Product','ds','y').to_pandas()
nf_df['y'] = nf_df['y'].fillna(0)
dl_cv = nf.cross_validation(df=nf_df,
Issue Severity
High: It blocks me from completing my task.