stable-baselines3/tests
liorcohen5 f5104a5efc
Allow to set a device when loading a model (#154)
* Added a 'device' keyword argument to BaseAlgorithm.load().
Edited the save and load test to also test the load method with all possible devices.
Added the changes to the changelog

* improved the load test to ensure that the model loads to the correct device.

* improved the test: now the correctness is improved. If the get_device policy would change, it wouldn't break the test.

* Update tests/test_save_load.py

@araffin's suggestion during the PR process

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Update tests/test_save_load.py

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Bug fixes: when comparing devices, comparing only device type since get_device() doesn't provide device index.
Now the code loads all of the model parameters from the saved state dict straight into the required device. (fixed load_from_zip_file).

* PR fixes: bug fix - a non-related test failed when running on GPU. updated the assertion to consider only types of devices. Also corrected a related bug in 'get_device()' method.

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-09-20 19:13:18 +02:00
..
__init__.py Init: TD3 2019-09-05 17:29:41 +02:00
test_callbacks.py Add StopTrainingOnMaxEpisodes to callback collection (#147) 2020-08-28 11:36:33 +02:00
test_cnn.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_custom_policy.py Update black version + update docker image (#151) 2020-08-27 23:02:59 +02:00
test_deterministic.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_distributions.py Update black version + update docker image (#151) 2020-08-27 23:02:59 +02:00
test_envs.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_identity.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_logger.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_monitor.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_predict.py Allow to set a device when loading a model (#154) 2020-09-20 19:13:18 +02:00
test_run.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_save_load.py Allow to set a device when loading a model (#154) 2020-09-20 19:13:18 +02:00
test_sde.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_spaces.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_tensorboard.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_utils.py Optimized polyak updates (#106) 2020-07-17 15:53:28 +02:00
test_vec_check_nan.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00
test_vec_envs.py Update black version + update docker image (#151) 2020-08-27 23:02:59 +02:00
test_vec_normalize.py Auto-formatting with black and isort (#97) 2020-07-16 16:12:16 +02:00