Closed Pythoniasm closed 10 months ago
Hello, thanks for reporting the issue. Pytorch doesn't provide any API/Helper to deal with that issue?
Hello! I can run this code without any issue with the latest pytorch (nightly release)
import gymnasium as gym
from stable_baselines3 import SAC
import torch as th
env = gym.make("Pendulum-v1")
model = SAC("MlpPolicy", env, verbose=1)
model.policy = th.compile(model.policy) # Compile the model
model.save("sac_pendulum")
del model # remove to demonstrate saving and loading
SAC.load("sac_pendulum")
Therefore, I think this issue can be closed (?)
Thanks for trying out =)
I can reproduce the issue with PyTorch cpu 2.1.1 but it is fixed with torch-2.2.0.dev20231212+cpu
.
Fixed two days ago, see https://github.com/pytorch/pytorch/issues/94575 and commit https://github.com/pytorch/pytorch/commit/38f890341df7a83decf6b6a7eed74786ce1ab866
🐛 Bug
Can be fixed easily, see #1439
To Reproduce
Relevant log output / Error message
System Info
Tested on
torch.compile
compatible OS (Linux, WSL) with CUDA and CPU.Checklist