Hi All, I'm trying to follow the tutorial for Hier...
# neural-forecast
p
Hi All, I'm trying to follow the tutorial for Hierarchical Forecast using the HINT class. https://nixtla.github.io/neuralforecast/examples/hierarchicalnetworks.html I am getting an error running this step:
Copy code
nf.fit(df=Y_train_df, val_size=12)
The final error message is:
Copy code
File ~/Documents/pyTorch/pytorch/lib/python3.9/site-packages/neuralforecast/common/_base_windows.py:460, in BaseWindows.training_step(self, batch, batch_idx)
    458     print("insample_y", torch.isnan(insample_y).sum())
    459     print("outsample_y", torch.isnan(outsample_y).sum())
--> 460     print("output", torch.isnan(output).sum())
    461     raise Exception("Loss is NaN, training stopped.")
    463 self.log("train_loss", loss, prog_bar=True, on_epoch=True)

TypeError: isnan(): argument 'input' (position 1) must be Tensor, not tuple
I am running this tutorial on a MacBook Pro 13.5 (22G74) with python version 3.9. Any idea what is going on?
m
what model are you using for cls_model
can you show me the code for your HINT class?
p
Sure. I am following the tutorial here line by line. https://nixtla.github.io/neuralforecast/examples/hierarchicalnetworks.html
Copy code
# Horizon and quantiles
level = np.arange(0, 100, 2)
qs = [[50-lv/2, 50+lv/2] if lv!=0 else [50] for lv in level]
quantiles = np.sort(np.concatenate(qs)/100)

# HINT := BaseNetwork + Distribution + Reconciliation
nhits = NHITS(h=horizon,
              input_size=24,
              loss=GMM(n_components=10, quantiles=quantiles),
              hist_exog_list=['month'],
              max_steps=2000,
              early_stop_patience_steps=10,
              val_check_steps=50,
              scaler_type='robust',
              learning_rate=1e-3,
              valid_loss=sCRPS(quantiles=quantiles))

model = HINT(h=horizon, S=S_df.values,
             model=nhits,  reconciliation='BottomUp')
m
you're using the dataset used int he example?
p
yes
Screenshot 2023-07-31 at 9.59.32 AM.png
m
one sec, running my notebook
p
Thank you
m
sorry, i dont know... I'm using my own dataset but it works for me =/
similar layout
p
Could it be a version problem? By similar layout, do you mean you are running it on the same specs? MacOS, etc...
m
no i meant dataframe layout is similar. Maybe? I'm on databricks
torch does have a specific version for mac iirc, not sure if that's the issue
p
I'll try to see if I can run it on Linux... I might have more luck there. Is it possible for you to check if it works with the toy example in the tutorial on databricks
for my own sanity 😅
m
sure
p
Thanks Mark! Much appreciated!
m
how long does it take to fail for you? running 7 minutes sof ar
p
Oh immediately
m
😬
yeah, def something with your environment i guess
i was thinking about buying a macbook air, good thing i didnt i guess 😉
🤣 1
p
Ok I'm installing what I need on my linux VM. Will see if it works there.
👍 1