-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix replay buffer device at load time (#20)
* Fix replay buffer device at load time * Fix imports * Update version * Reformat and add test * Fix test * Fix for mypy
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.9.0 | ||
0.9.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
import torch as th | ||
|
||
from sbx import SAC | ||
|
||
|
||
def test_force_cpu_device(tmp_path): | ||
if not th.cuda.is_available(): | ||
pytest.skip("No CUDA device") | ||
model = SAC("MlpPolicy", "Pendulum-v1", buffer_size=200) | ||
assert model.replay_buffer.device == th.device("cpu") | ||
model.save_replay_buffer(tmp_path / "replay") | ||
model.load_replay_buffer(tmp_path / "replay") | ||
assert model.replay_buffer.device == th.device("cpu") |