В настоящее время я работаю над проектом, в котором мне нужно использовать GluonTS (DeepAREstimator и DLinearEstimator). Вначале это работало хорошо. Но теперь, даже когда я использую пример кода с веб-сайта GluonTS, я всегда получаю следующее сообщение об ошибке:
Traceback (most recent call last):
File "/home/alland/Desktop/project.py", line 24, in
).train(training_data)
^^^^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/gluonts/torch/model/estimator.py", line 246, in train
return self.train_model(
^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/gluonts/torch/model/estimator.py", line 220, in train_model
best_model = training_network.__class__.load_from_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/utilities/model_helpers.py", line 130, in wrapper
return self.method(cls_type, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/core/module.py", line 1797, in load_from_checkpoint
loaded = _load_from_checkpoint(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/core/saving.py", line 65, in _load_from_checkpoint
checkpoint = pl_load(checkpoint_path, map_location=map_location, weights_only=weights_only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/fabric/utilities/cloud_io.py", line 73, in _load
return torch.load(
^^^^^^^^^^^
File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/torch/serialization.py", line 1548, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL functools.partial was not an allowed global by default. Please use `torch.serialization.add_safe_globals([functools.partial])` or the `torch.serialization.safe_globals([functools.partial])` context manager to allowlist this global if you trust this class/function.
Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
Я даже переустановил Linux Mint и заново скачал все необходимые пакеты. Но у меня все еще есть эта ошибка. Я в замешательстве, потому что ранее в этот день тот же код работал без ошибок. Кто-нибудь знает, в чем причина этого? Я уже пытался немного это исправить, но мне это кажется сложной ошибкой. Я просто хотел закончить свой проект сегодня....
В настоящее время я работаю над проектом, в котором мне нужно использовать GluonTS (DeepAREstimator и DLinearEstimator). Вначале это работало хорошо. Но теперь, даже когда я использую пример кода с веб-сайта GluonTS, я всегда получаю следующее сообщение об ошибке: [code]Traceback (most recent call last): File "/home/alland/Desktop/project.py", line 24, in ).train(training_data) ^^^^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/gluonts/torch/model/estimator.py", line 246, in train return self.train_model( ^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/gluonts/torch/model/estimator.py", line 220, in train_model best_model = training_network.__class__.load_from_checkpoint( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/utilities/model_helpers.py", line 130, in wrapper return self.method(cls_type, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/core/module.py", line 1797, in load_from_checkpoint loaded = _load_from_checkpoint( ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/pytorch/core/saving.py", line 65, in _load_from_checkpoint checkpoint = pl_load(checkpoint_path, map_location=map_location, weights_only=weights_only) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/lightning/fabric/utilities/cloud_io.py", line 73, in _load return torch.load( ^^^^^^^^^^^ File "/home/alland/PyCharmMiscProject/.venv/lib/python3.12/site-packages/torch/serialization.py", line 1548, in load raise pickle.UnpicklingError(_get_wo_message(str(e))) from None _pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint. (1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source. (2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message. WeightsUnpickler error: Unsupported global: GLOBAL functools.partial was not an allowed global by default. Please use `torch.serialization.add_safe_globals([functools.partial])` or the `torch.serialization.safe_globals([functools.partial])` context manager to allowlist this global if you trust this class/function.
Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html. [/code] Я даже переустановил Linux Mint и заново скачал все необходимые пакеты. Но у меня все еще есть эта ошибка. Я в замешательстве, потому что ранее в этот день тот же код работал без ошибок. Кто-нибудь знает, в чем причина этого? Я уже пытался немного это исправить, но мне это кажется сложной ошибкой. Я просто хотел закончить свой проект сегодня....