Fix PyTorch 2.6 checkpoint loading incompatibility with NeuralProphet #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PyTorch 2.6 changed
torch.load(weights_only=True)as the new default, causing NeuralProphet checkpoint deserialization to fail during LR finder withUnpicklingError: Unsupported global: GLOBAL neuralprophet.configure.ConfigSeasonality.Changes
The fix allowlists NeuralProphet configuration classes (
ConfigSeasonality,Season,Trend,ConfigTrain,ConfigAR,ConfigLagged,ConfigEvents,ConfigCountryHolidays) viatorch.serialization.add_safe_globals(). Wrapped in try-except for backward compatibility with PyTorch <2.6.Original prompt
This section details on the original issue you should resolve
<issue_title>Stuck in error loop</issue_title>
<issue_description>Just dipping my toes in the PredAI water.....
It's installed, but when starting it up I end up in a loop - this is the full log which just then repeats continously......
[12:07:03] INFO: PredAI init script running
Running App Process Management
Your API key is: 48715a5c205433598e1597b1b85e1e36647035ac923eda112bab5ff1574a563402d8e4b345fae8aabbed427cf2dffc0d72cdbe4a2e365467
Bootstrap predai
Copy initial python files
Startup
Importing plotly failed. Interactive plots will not work.
Importing plotly failed. Interactive plots will not work.
HA Interface started key 48715a5c205433598e1597b1b85e1e36647035ac923eda112bab5ff1574a563402d8e4b345fae8aabbed427cf2dffc0d72cdbe4a2e365467 url http://supervisor/core
Configuration loaded
Update at time 2025-12-30 12:00:00+00:00 Processing sensor sensor.load_today incrementing True max_increment 0 reset_daily True interval 30 days 14 export_days 14 subtract None
Getting history for sensor sensor.load_today start 2025-12-16T12:00:00+0000 end 2025-12-30T12:00:00+0000
History for sensor sensor.load_today starts at 2025-12-20 04:13:00+00:00 ends at 2025-12-30 11:59:00+00:00
Process dataset for sensor sensor.load_today start 2025-12-20 04:13:00+00:00 end 2025-12-30 11:59:00+00:00 incrementing True reset_low 1.0 reset_high 2.0
ds y
0 2025-12-20 04:00:00+00:00 0.00
1 2025-12-20 04:30:00+00:00 0.10
2 2025-12-20 05:00:00+00:00 0.13
3 2025-12-20 05:30:00+00:00 0.20
4 2025-12-20 06:00:00+00:00 0.19
.. ... ...
491 2025-12-30 09:30:00+00:00 0.31
492 2025-12-30 10:00:00+00:00 0.47
493 2025-12-30 10:30:00+00:00 0.28
494 2025-12-30 11:00:00+00:00 0.23
495 2025-12-30 11:30:00+00:00 1.11
[496 rows x 2 columns]
Create table sensor_load_today
Added 0 rows to database table sensor_load_today
Cleanup table sensor_load_today older than 2024-12-30 12:07:08+0000
Stored dataset in database and retrieved full history from database length 976
WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/neuralprophet/df_utils.py:464: FutureWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass
include_groups=Falseto exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.if df.groupby("ID").apply(lambda x: x.duplicated("ds").any()).any():
WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/neuralprophet/df_utils.py:1152: FutureWarning: Series.view is deprecated and will be removed in a future version. Use
astypeas an alternative to change the dtype.converted_ds = pd.to_datetime(ds_col, utc=True).view(dtype=np.int64)
WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/neuralprophet/df_utils.py:1152: FutureWarning: Series.view is deprecated and will be removed in a future version. Use
astypeas an alternative to change the dtype.converted_ds = pd.to_datetime(ds_col, utc=True).view(dtype=np.int64)
WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/neuralprophet/df_utils.py:1152: FutureWarning: Series.view is deprecated and will be removed in a future version. Use
astypeas an alternative to change the dtype.converted_ds = pd.to_datetime(ds_col, utc=True).view(dtype=np.int64)
Finding best initial lr: 0%| | 0/225 [00:00<?, ?it/s]WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/pytorch_lightning/utilities/data.py:79: Trying to infer the
batch_sizefrom an ambiguous collection. The batch size we found is 32. To avoid any miscalculations, useself.log(..., batch_size=batch_size).Finding best initial lr: 0%| | 1/225 [00:00<00:32, 6.80it/s]
Finding best initial lr: 7%|▋ | 16/225 [00:00<00:02, 77.24it/s]WARNING - (py.warnings._showwarnmsg) - /usr/local/lib/python3.10/dist-packages/pytorch_lightning/utilities/data.py:79: Trying to infer the
batch_sizefrom an ambiguous collection. The batch size we found is 16. To avoid any miscalculations, useself.log(..., batch_size=batch_size).Finding best initial lr: 14%|█▍ | 31/225 [00:00<00:01, 106.23it/s]
Finding best initial lr: 20%|██ | 46/225 [00:00<00:01, 122.09it/s]
Finding best initial lr: 28%|██▊ | 62/225 [00:00<00:01, 132.43it/s]
Finding best initial lr: 34%|███▍ | 77/225 [00:00<00:01, 138.02it/s]
Finding best initial lr: 41%|████▏ | 93/225 [00:00<00:00, 142.27it/s]
Finding best initial lr: 48%|████▊ | 108/225 [00:00<00:00, 141.45it/s]
Finding best initial lr: 55%|█████▍ | 123/225 [00:00<00:00, 142.25it/s]
Finding best initial lr: 61%|██████▏ | 138/225 [00:01<00:00, 144.06it/s]
Finding best ini...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.