diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9582ed3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# Virtual environments +venv/ +ENV/ +env/ + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db diff --git a/predai/rootfs/predai.py b/predai/rootfs/predai.py index e0a47cd..a0093e2 100644 --- a/predai/rootfs/predai.py +++ b/predai/rootfs/predai.py @@ -13,6 +13,37 @@ import math import yaml +# Fix for PyTorch 2.6 weights_only=True default +# Add NeuralProphet classes to safe globals for checkpoint loading +try: + import torch.serialization + from neuralprophet.configure import ( + ConfigSeasonality, + Season, + Trend, + ConfigTrain, + ConfigAR, + ConfigLagged, + ConfigEvents, + ConfigCountryHolidays, + ) + + # Add all NeuralProphet configuration classes to safe globals + torch.serialization.add_safe_globals([ + ConfigSeasonality, + Season, + Trend, + ConfigTrain, + ConfigAR, + ConfigLagged, + ConfigEvents, + ConfigCountryHolidays, + ]) +except (ImportError, AttributeError): + # If torch.serialization or classes are not available, continue without the fix + # This allows backward compatibility with older PyTorch versions + pass + TIMEOUT = 240 TIME_FORMAT_HA = "%Y-%m-%dT%H:%M:%S%z" TIME_FORMAT_HA_DOT = "%Y-%m-%dT%H:%M:%S.%f%z"