File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -758,16 +758,16 @@ def test_no_resource_warning(tmp_path):
758
758
759
759
# check that files are properly closed
760
760
# Create a PPO agent and save it
761
- PPO ("MlpPolicy" , "CartPole-v1" ).save (tmp_path / "dqn_cartpole" )
762
- PPO .load (tmp_path / "dqn_cartpole" )
761
+ PPO ("MlpPolicy" , "CartPole-v1" , device = "cpu" ).save (tmp_path / "dqn_cartpole" )
762
+ PPO .load (tmp_path / "dqn_cartpole" , device = "cpu" )
763
763
764
- PPO ("MlpPolicy" , "CartPole-v1" ).save (str (tmp_path / "dqn_cartpole" ))
765
- PPO .load (str (tmp_path / "dqn_cartpole" ))
764
+ PPO ("MlpPolicy" , "CartPole-v1" , device = "cpu" ).save (str (tmp_path / "dqn_cartpole" ))
765
+ PPO .load (str (tmp_path / "dqn_cartpole" ), device = "cpu" )
766
766
767
767
# Do the same but in memory, should not close the file
768
768
with tempfile .TemporaryFile () as fp :
769
- PPO ("MlpPolicy" , "CartPole-v1" ).save (fp )
770
- PPO .load (fp )
769
+ PPO ("MlpPolicy" , "CartPole-v1" , device = "cpu" ).save (fp )
770
+ PPO .load (fp , device = "cpu" )
771
771
assert not fp .closed
772
772
773
773
# Same but with replay buffer
You can’t perform that action at this time.
0 commit comments