mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-18 09:54:10 +00:00
Rename to stable-baselines3
This commit is contained in:
parent
4a2c247592
commit
d542732c8d
72 changed files with 164 additions and 164 deletions
|
|
@ -4,7 +4,7 @@ omit =
|
||||||
tests/*
|
tests/*
|
||||||
setup.py
|
setup.py
|
||||||
# Require graphical interface
|
# Require graphical interface
|
||||||
torchy_baselines/common/results_plotter.py
|
stable_baselines3/common/results_plotter.py
|
||||||
|
|
||||||
[report]
|
[report]
|
||||||
exclude_lines =
|
exclude_lines =
|
||||||
|
|
|
||||||
4
.github/ISSUE_TEMPLATE/issue-template.md
vendored
4
.github/ISSUE_TEMPLATE/issue-template.md
vendored
|
|
@ -13,7 +13,7 @@ If you are submitting a bug report, please fill in the following details.
|
||||||
If your issue is related to a custom gym environment, please check it first using:
|
If your issue is related to a custom gym environment, please check it first using:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from torchy_baselines.common.env_checker import check_env
|
from stable_baselines3.common.env_checker import check_env
|
||||||
|
|
||||||
env = CustomEnv(arg1, ...)
|
env = CustomEnv(arg1, ...)
|
||||||
# It will check your custom environment and output additional warnings if needed
|
# It will check your custom environment and output additional warnings if needed
|
||||||
|
|
@ -30,7 +30,7 @@ Please use the [markdown code blocks](https://help.github.com/en/articles/creati
|
||||||
for both code and stack traces.
|
for both code and stack traces.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from torchy_baselines import ...
|
from stable_baselines3 import ...
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
2
NOTICE
2
NOTICE
|
|
@ -1,4 +1,4 @@
|
||||||
Large portion of the code of Torchy-Baselines (in `common/`) were ported from Stable-Baselines, a fork of OpenAI Baselines,
|
Large portion of the code of Stable-Baselines3 (in `common/`) were ported from Stable-Baselines, a fork of OpenAI Baselines,
|
||||||
both licensed under the MIT License:
|
both licensed under the MIT License:
|
||||||
|
|
||||||
before the fork (June 2018):
|
before the fork (June 2018):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[](https://travis-ci.com/hill-a/stable-baselines) [](https://stable-baselines.readthedocs.io/en/master/?badge=master)
|
[](https://travis-ci.com/hill-a/stable-baselines) [](https://stable-baselines.readthedocs.io/en/master/?badge=master)
|
||||||
|
|
||||||
# Torchy Baselines
|
# Stable Baselines3
|
||||||
|
|
||||||
PyTorch version of [Stable Baselines](https://github.com/hill-a/stable-baselines), a set of improved implementations of reinforcement learning algorithms.
|
PyTorch version of [Stable Baselines](https://github.com/hill-a/stable-baselines), a set of improved implementations of reinforcement learning algorithms.
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ To cite this repository in publications:
|
||||||
```
|
```
|
||||||
@misc{torchy-baselines,
|
@misc{torchy-baselines,
|
||||||
author = {Raffin, Antonin and Hill, Ashley and Ernestus, Maximilian and Gleave, Adam and Kanervisto, Anssi and Dormann, Noah},
|
author = {Raffin, Antonin and Hill, Ashley and Ernestus, Maximilian and Gleave, Adam and Kanervisto, Anssi and Dormann, Noah},
|
||||||
title = {Torchy Baselines},
|
title = {Stable Baselines3},
|
||||||
year = {2019},
|
year = {2019},
|
||||||
publisher = {GitHub},
|
publisher = {GitHub},
|
||||||
journal = {GitHub repository},
|
journal = {GitHub repository},
|
||||||
|
|
|
||||||
20
docs/conf.py
20
docs/conf.py
|
|
@ -44,19 +44,19 @@ MOCK_MODULES = []
|
||||||
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
|
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
|
||||||
|
|
||||||
|
|
||||||
import torchy_baselines
|
import stable_baselines3
|
||||||
|
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
project = 'Torchy Baselines'
|
project = 'Stable Baselines3'
|
||||||
copyright = '2020, Torchy Baselines'
|
copyright = '2020, Stable Baselines3'
|
||||||
author = 'Torchy Baselines Contributors'
|
author = 'Stable Baselines3 Contributors'
|
||||||
|
|
||||||
# The short X.Y version
|
# The short X.Y version
|
||||||
version = 'master (' + torchy_baselines.__version__ + ' )'
|
version = 'master (' + stable_baselines3.__version__ + ' )'
|
||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = torchy_baselines.__version__
|
release = stable_baselines3.__version__
|
||||||
|
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
@ -179,8 +179,8 @@ latex_elements = {
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, 'TorchyBaselines.tex', 'Torchy Baselines Documentation',
|
(master_doc, 'TorchyBaselines.tex', 'Stable Baselines3 Documentation',
|
||||||
'Torchy Baselines Contributors', 'manual'),
|
'Stable Baselines3 Contributors', 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -189,7 +189,7 @@ latex_documents = [
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [
|
||||||
(master_doc, 'torchybaselines', 'Torchy Baselines Documentation',
|
(master_doc, 'torchybaselines', 'Stable Baselines3 Documentation',
|
||||||
[author], 1)
|
[author], 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ man_pages = [
|
||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
(master_doc, 'TorchyBaselines', 'Torchy Baselines Documentation',
|
(master_doc, 'TorchyBaselines', 'Stable Baselines3 Documentation',
|
||||||
author, 'TorchyBaselines', 'One line description of project.',
|
author, 'TorchyBaselines', 'One line description of project.',
|
||||||
'Miscellaneous'),
|
'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ Here is a quick example of how to train and run SAC on a Pendulum environment:
|
||||||
|
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines.sac.policies import MlpPolicy
|
from stable_baselines3.sac.policies import MlpPolicy
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv
|
from stable_baselines3.common.vec_env import DummyVecEnv
|
||||||
from torchy_baselines import SAC
|
from stable_baselines3 import SAC
|
||||||
|
|
||||||
env = gym.make('Pendulum-v0')
|
env = gym.make('Pendulum-v0')
|
||||||
|
|
||||||
|
|
@ -34,6 +34,6 @@ the policy is registered:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from torchy_baselines import SAC
|
from stable_baselines3 import SAC
|
||||||
|
|
||||||
model = SAC('MlpPolicy', 'Pendulum-v0').learn(10000)
|
model = SAC('MlpPolicy', 'Pendulum-v0').learn(10000)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _vec_env:
|
.. _vec_env:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.common.vec_env
|
.. automodule:: stable_baselines3.common.vec_env
|
||||||
|
|
||||||
Vectorized Environments
|
Vectorized Environments
|
||||||
=======================
|
=======================
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
You can adapt this file completely to your liking, but it should at least
|
You can adapt this file completely to your liking, but it should at least
|
||||||
contain the root `toctree` directive.
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
Welcome to Torchy Baselines docs! - Pytorch RL Baselines
|
Welcome to Stable Baselines3 docs! - Pytorch RL Baselines
|
||||||
========================================================
|
========================================================
|
||||||
|
|
||||||
`Torchy Baselines <https://github.com/hill-a/stable-baselines>`_ is the PyTorch version of `Stable Baselines <https://github.com/hill-a/stable-baselines>`_,
|
`Stable Baselines3 <https://github.com/hill-a/stable-baselines>`_ is the PyTorch version of `Stable Baselines <https://github.com/hill-a/stable-baselines>`_,
|
||||||
a set of improved implementations of reinforcement learning algorithms.
|
a set of improved implementations of reinforcement learning algorithms.
|
||||||
|
|
||||||
RL Baselines Zoo (collection of pre-trained agents): https://github.com/araffin/rl-baselines-zoo
|
RL Baselines Zoo (collection of pre-trained agents): https://github.com/araffin/rl-baselines-zoo
|
||||||
|
|
@ -41,7 +41,7 @@ RL Baselines zoo also offers a simple interface to train, evaluate agents and do
|
||||||
misc/changelog
|
misc/changelog
|
||||||
|
|
||||||
|
|
||||||
Citing Torchy Baselines
|
Citing Stable Baselines3
|
||||||
-----------------------
|
-----------------------
|
||||||
To cite this project in publications:
|
To cite this project in publications:
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ To cite this project in publications:
|
||||||
|
|
||||||
@misc{torchy-baselines,
|
@misc{torchy-baselines,
|
||||||
author = {Raffin, Antonin and Hill, Ashley and Ernestus, Maximilian and Gleave, Adam and Kanervisto, Anssi and Dormann, Noah},
|
author = {Raffin, Antonin and Hill, Ashley and Ernestus, Maximilian and Gleave, Adam and Kanervisto, Anssi and Dormann, Noah},
|
||||||
title = {Torchy Baselines},
|
title = {Stable Baselines3},
|
||||||
year = {2019},
|
year = {2019},
|
||||||
publisher = {GitHub},
|
publisher = {GitHub},
|
||||||
journal = {GitHub repository},
|
journal = {GitHub repository},
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ Pre-Release 0.2.0 (2020-02-14)
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
- Python 2 support was dropped, Torchy Baselines now requires Python 3.6 or above
|
- Python 2 support was dropped, Stable Baselines3 now requires Python 3.6 or above
|
||||||
- Return type of ``evaluation.evaluate_policy()`` has been changed
|
- Return type of ``evaluation.evaluate_policy()`` has been changed
|
||||||
- Refactored the replay buffer to avoid transformation between PyTorch and NumPy
|
- Refactored the replay buffer to avoid transformation between PyTorch and NumPy
|
||||||
- Created `OffPolicyRLModel` base class
|
- Created `OffPolicyRLModel` base class
|
||||||
|
|
@ -160,7 +160,7 @@ New Features:
|
||||||
Maintainers
|
Maintainers
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Torchy-Baselines is currently maintained by `Antonin Raffin`_ (aka `@araffin`_).
|
Stable-Baselines3 is currently maintained by `Antonin Raffin`_ (aka `@araffin`_).
|
||||||
|
|
||||||
.. _Antonin Raffin: https://araffin.github.io/
|
.. _Antonin Raffin: https://araffin.github.io/
|
||||||
.. _@araffin: https://github.com/araffin
|
.. _@araffin: https://github.com/araffin
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _a2c:
|
.. _a2c:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.a2c
|
.. automodule:: stable_baselines3.a2c
|
||||||
|
|
||||||
|
|
||||||
A2C
|
A2C
|
||||||
|
|
@ -44,9 +44,9 @@ Train a A2C agent on `CartPole-v1` using 4 processes.
|
||||||
|
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines.common.policies import MlpPolicy
|
from stable_baselines3.common.policies import MlpPolicy
|
||||||
from torchy_baselines.common import make_vec_env
|
from stable_baselines3.common import make_vec_env
|
||||||
from torchy_baselines import A2C
|
from stable_baselines3 import A2C
|
||||||
|
|
||||||
# Parallel environments
|
# Parallel environments
|
||||||
env = make_vec_env('CartPole-v1', n_envs=4)
|
env = make_vec_env('CartPole-v1', n_envs=4)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _base_algo:
|
.. _base_algo:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.common.base_class
|
.. automodule:: stable_baselines3.common.base_class
|
||||||
|
|
||||||
|
|
||||||
Base RL Class
|
Base RL Class
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _ppo2:
|
.. _ppo2:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.ppo
|
.. automodule:: stable_baselines3.ppo
|
||||||
|
|
||||||
PPO
|
PPO
|
||||||
===
|
===
|
||||||
|
|
@ -53,9 +53,9 @@ Train a PPO agent on `Pendulum-v0` using 4 processes.
|
||||||
|
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines.ppo.policies import MlpPolicy
|
from stable_baselines3.ppo.policies import MlpPolicy
|
||||||
from torchy_baselines.common.vec_env import SubprocVecEnv
|
from stable_baselines3.common.vec_env import SubprocVecEnv
|
||||||
from torchy_baselines import PPO
|
from stable_baselines3 import PPO
|
||||||
|
|
||||||
# multiprocess environment
|
# multiprocess environment
|
||||||
n_cpu = 4
|
n_cpu = 4
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _sac:
|
.. _sac:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.sac
|
.. automodule:: stable_baselines3.sac
|
||||||
|
|
||||||
|
|
||||||
SAC
|
SAC
|
||||||
|
|
@ -14,7 +14,7 @@ A key feature of SAC, and a major difference with common RL algorithms, is that
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
The SAC model does not support ``torchy_baselines.common.policies`` because it uses double q-values
|
The SAC model does not support ``stable_baselines3.common.policies`` because it uses double q-values
|
||||||
and value estimation, as a result it must use its own policy models (see :ref:`sac_policies`).
|
and value estimation, as a result it must use its own policy models (see :ref:`sac_policies`).
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -72,9 +72,9 @@ Example
|
||||||
import gym
|
import gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.sac.policies import MlpPolicy
|
from stable_baselines3.sac.policies import MlpPolicy
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv
|
from stable_baselines3.common.vec_env import DummyVecEnv
|
||||||
from torchy_baselines import SAC
|
from stable_baselines3 import SAC
|
||||||
|
|
||||||
env = gym.make('Pendulum-v0')
|
env = gym.make('Pendulum-v0')
|
||||||
env = DummyVecEnv([lambda: env])
|
env = DummyVecEnv([lambda: env])
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.. _td3:
|
.. _td3:
|
||||||
|
|
||||||
.. automodule:: torchy_baselines.td3
|
.. automodule:: stable_baselines3.td3
|
||||||
|
|
||||||
|
|
||||||
TD3
|
TD3
|
||||||
|
|
@ -14,7 +14,7 @@ We recommend reading `OpenAI Spinning guide on TD3 <https://spinningup.openai.co
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
The TD3 model does not support ``torchy_baselines.common.policies`` because it uses double q-values
|
The TD3 model does not support ``stable_baselines3.common.policies`` because it uses double q-values
|
||||||
estimation, as a result it must use its own policy models (see :ref:`td3_policies`).
|
estimation, as a result it must use its own policy models (see :ref:`td3_policies`).
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,9 +64,9 @@ Example
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines import TD3
|
from stable_baselines3 import TD3
|
||||||
from torchy_baselines.td3.policies import MlpPolicy
|
from stable_baselines3.td3.policies import MlpPolicy
|
||||||
from torchy_baselines.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
|
from stable_baselines3.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
|
||||||
|
|
||||||
# The noise objects for TD3
|
# The noise objects for TD3
|
||||||
n_actions = env.action_space.shape[-1]
|
n_actions = env.action_space.shape[-1]
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ filterwarnings =
|
||||||
ignore::UserWarning:gym
|
ignore::UserWarning:gym
|
||||||
|
|
||||||
[pytype]
|
[pytype]
|
||||||
inputs = torchy_baselines
|
inputs = stable_baselines3
|
||||||
|
|
|
||||||
6
setup.py
6
setup.py
|
|
@ -3,13 +3,13 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
with open(os.path.join('torchy_baselines', 'version.txt'), 'r') as file_handler:
|
with open(os.path.join('stable_baselines3', 'version.txt'), 'r') as file_handler:
|
||||||
__version__ = file_handler.read()
|
__version__ = file_handler.read()
|
||||||
|
|
||||||
|
|
||||||
setup(name='torchy_baselines',
|
setup(name='stable_baselines3',
|
||||||
packages=[package for package in find_packages()
|
packages=[package for package in find_packages()
|
||||||
if package.startswith('torchy_baselines')],
|
if package.startswith('stable_baselines3')],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'gym[classic_control]>=0.11',
|
'gym[classic_control]>=0.11',
|
||||||
'numpy',
|
'numpy',
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from torchy_baselines.a2c import A2C
|
from stable_baselines3.a2c import A2C
|
||||||
from torchy_baselines.ppo import PPO
|
from stable_baselines3.ppo import PPO
|
||||||
from torchy_baselines.sac import SAC
|
from stable_baselines3.sac import SAC
|
||||||
from torchy_baselines.td3 import TD3
|
from stable_baselines3.td3 import TD3
|
||||||
|
|
||||||
# Read version from file
|
# Read version from file
|
||||||
version_file = os.path.join(os.path.dirname(__file__), 'version.txt')
|
version_file = os.path.join(os.path.dirname(__file__), 'version.txt')
|
||||||
2
stable_baselines3/a2c/__init__.py
Normal file
2
stable_baselines3/a2c/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
from stable_baselines3.a2c.a2c import A2C
|
||||||
|
from stable_baselines3.ppo.policies import MlpPolicy
|
||||||
|
|
@ -3,11 +3,11 @@ import torch.nn.functional as F
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
from typing import Type, Union, Callable, Optional, Dict, Any
|
from typing import Type, Union, Callable, Optional, Dict, Any
|
||||||
|
|
||||||
from torchy_baselines.common import logger
|
from stable_baselines3.common import logger
|
||||||
from torchy_baselines.common.type_aliases import GymEnv, MaybeCallback
|
from stable_baselines3.common.type_aliases import GymEnv, MaybeCallback
|
||||||
from torchy_baselines.common.utils import explained_variance
|
from stable_baselines3.common.utils import explained_variance
|
||||||
from torchy_baselines.ppo.policies import PPOPolicy
|
from stable_baselines3.ppo.policies import PPOPolicy
|
||||||
from torchy_baselines.ppo.ppo import PPO
|
from stable_baselines3.ppo.ppo import PPO
|
||||||
|
|
||||||
|
|
||||||
class A2C(PPO):
|
class A2C(PPO):
|
||||||
|
|
@ -11,17 +11,17 @@ import gym
|
||||||
import torch as th
|
import torch as th
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common import logger
|
from stable_baselines3.common import logger
|
||||||
from torchy_baselines.common.policies import BasePolicy, get_policy_from_name
|
from stable_baselines3.common.policies import BasePolicy, get_policy_from_name
|
||||||
from torchy_baselines.common.utils import set_random_seed, get_schedule_fn, update_learning_rate, get_device
|
from stable_baselines3.common.utils import set_random_seed, get_schedule_fn, update_learning_rate, get_device
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv, VecEnv, unwrap_vec_normalize, VecNormalize, VecTransposeImage
|
from stable_baselines3.common.vec_env import DummyVecEnv, VecEnv, unwrap_vec_normalize, VecNormalize, VecTransposeImage
|
||||||
from torchy_baselines.common.preprocessing import is_image_space
|
from stable_baselines3.common.preprocessing import is_image_space
|
||||||
from torchy_baselines.common.save_util import data_to_json, json_to_data, recursive_getattr, recursive_setattr
|
from stable_baselines3.common.save_util import data_to_json, json_to_data, recursive_getattr, recursive_setattr
|
||||||
from torchy_baselines.common.type_aliases import GymEnv, TensorDict, RolloutReturn, MaybeCallback
|
from stable_baselines3.common.type_aliases import GymEnv, TensorDict, RolloutReturn, MaybeCallback
|
||||||
from torchy_baselines.common.callbacks import BaseCallback, CallbackList, ConvertCallback, EvalCallback
|
from stable_baselines3.common.callbacks import BaseCallback, CallbackList, ConvertCallback, EvalCallback
|
||||||
from torchy_baselines.common.monitor import Monitor
|
from stable_baselines3.common.monitor import Monitor
|
||||||
from torchy_baselines.common.noise import ActionNoise
|
from stable_baselines3.common.noise import ActionNoise
|
||||||
from torchy_baselines.common.buffers import ReplayBuffer
|
from stable_baselines3.common.buffers import ReplayBuffer
|
||||||
|
|
||||||
|
|
||||||
class BaseRLModel(ABC):
|
class BaseRLModel(ABC):
|
||||||
|
|
@ -4,9 +4,9 @@ import numpy as np
|
||||||
import torch as th
|
import torch as th
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env import VecNormalize
|
from stable_baselines3.common.vec_env import VecNormalize
|
||||||
from torchy_baselines.common.type_aliases import RolloutBufferSamples, ReplayBufferSamples
|
from stable_baselines3.common.type_aliases import RolloutBufferSamples, ReplayBufferSamples
|
||||||
from torchy_baselines.common.preprocessing import get_action_dim, get_obs_shape
|
from stable_baselines3.common.preprocessing import get_action_dim, get_obs_shape
|
||||||
|
|
||||||
|
|
||||||
class BaseBuffer(object):
|
class BaseBuffer(object):
|
||||||
|
|
@ -7,12 +7,12 @@ from typing import Union, List, Dict, Any, Optional
|
||||||
import gym
|
import gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv, VecEnv, sync_envs_normalization
|
from stable_baselines3.common.vec_env import DummyVecEnv, VecEnv, sync_envs_normalization
|
||||||
from torchy_baselines.common.evaluation import evaluate_policy
|
from stable_baselines3.common.evaluation import evaluate_policy
|
||||||
from torchy_baselines.common.logger import Logger
|
from stable_baselines3.common.logger import Logger
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from torchy_baselines.common.base_class import BaseRLModel # pytype: disable=pyi-error
|
from stable_baselines3.common.base_class import BaseRLModel # pytype: disable=pyi-error
|
||||||
|
|
||||||
|
|
||||||
class BaseCallback(ABC):
|
class BaseCallback(ABC):
|
||||||
|
|
@ -6,7 +6,7 @@ import torch.nn as nn
|
||||||
from torch.distributions import Normal, Categorical
|
from torch.distributions import Normal, Categorical
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
|
|
||||||
from torchy_baselines.common.preprocessing import get_action_dim
|
from stable_baselines3.common.preprocessing import get_action_dim
|
||||||
|
|
||||||
|
|
||||||
class Distribution(object):
|
class Distribution(object):
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Copied from stable_baselines
|
# Copied from stable_baselines
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env import VecEnv
|
from stable_baselines3.common.vec_env import VecEnv
|
||||||
|
|
||||||
|
|
||||||
def evaluate_policy(model, env, n_eval_episodes=10, deterministic=True,
|
def evaluate_policy(model, env, n_eval_episodes=10, deterministic=True,
|
||||||
|
|
@ -5,7 +5,7 @@ from gym import Env
|
||||||
from gym.spaces import Discrete, MultiDiscrete, MultiBinary, Box
|
from gym.spaces import Discrete, MultiDiscrete, MultiBinary, Box
|
||||||
|
|
||||||
|
|
||||||
from torchy_baselines.common.type_aliases import GymStepReturn, GymObs
|
from stable_baselines3.common.type_aliases import GymStepReturn, GymObs
|
||||||
|
|
||||||
|
|
||||||
class IdentityEnv(Env):
|
class IdentityEnv(Env):
|
||||||
|
|
@ -7,9 +7,9 @@ import torch as th
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.preprocessing import preprocess_obs, get_flattened_obs_dim, is_image_space
|
from stable_baselines3.common.preprocessing import preprocess_obs, get_flattened_obs_dim, is_image_space
|
||||||
from torchy_baselines.common.utils import get_device
|
from stable_baselines3.common.utils import get_device
|
||||||
from torchy_baselines.common.vec_env import VecTransposeImage
|
from stable_baselines3.common.vec_env import VecTransposeImage
|
||||||
|
|
||||||
|
|
||||||
class BaseFeaturesExtractor(nn.Module):
|
class BaseFeaturesExtractor(nn.Module):
|
||||||
|
|
@ -6,7 +6,7 @@ import pandas as pd
|
||||||
# matplotlib.use('TkAgg') # Can change to 'Agg' for non-interactive mode
|
# matplotlib.use('TkAgg') # Can change to 'Agg' for non-interactive mode
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from torchy_baselines.common.monitor import load_results
|
from stable_baselines3.common.monitor import load_results
|
||||||
|
|
||||||
|
|
||||||
X_TIMESTEPS = 'timesteps'
|
X_TIMESTEPS = 'timesteps'
|
||||||
|
|
@ -7,8 +7,8 @@ import numpy as np
|
||||||
import torch as th
|
import torch as th
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env import VecEnv
|
from stable_baselines3.common.vec_env import VecEnv
|
||||||
from torchy_baselines.common.callbacks import BaseCallback
|
from stable_baselines3.common.callbacks import BaseCallback
|
||||||
|
|
||||||
|
|
||||||
GymEnv = Union[gym.Env, VecEnv]
|
GymEnv = Union[gym.Env, VecEnv]
|
||||||
|
|
@ -3,17 +3,17 @@ import typing
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import (AlreadySteppingError, NotSteppingError,
|
from stable_baselines3.common.vec_env.base_vec_env import (AlreadySteppingError, NotSteppingError,
|
||||||
VecEnv, VecEnvWrapper, CloudpickleWrapper)
|
VecEnv, VecEnvWrapper, CloudpickleWrapper)
|
||||||
from torchy_baselines.common.vec_env.dummy_vec_env import DummyVecEnv
|
from stable_baselines3.common.vec_env.dummy_vec_env import DummyVecEnv
|
||||||
from torchy_baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
|
from stable_baselines3.common.vec_env.subproc_vec_env import SubprocVecEnv
|
||||||
from torchy_baselines.common.vec_env.vec_frame_stack import VecFrameStack
|
from stable_baselines3.common.vec_env.vec_frame_stack import VecFrameStack
|
||||||
from torchy_baselines.common.vec_env.vec_normalize import VecNormalize
|
from stable_baselines3.common.vec_env.vec_normalize import VecNormalize
|
||||||
from torchy_baselines.common.vec_env.vec_transpose import VecTransposeImage
|
from stable_baselines3.common.vec_env.vec_transpose import VecTransposeImage
|
||||||
|
|
||||||
# Avoid circular import
|
# Avoid circular import
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from torchy_baselines.common.type_aliases import GymEnv
|
from stable_baselines3.common.type_aliases import GymEnv
|
||||||
|
|
||||||
|
|
||||||
def unwrap_vec_normalize(env: Union['GymEnv', VecEnv]) -> Optional[VecNormalize]:
|
def unwrap_vec_normalize(env: Union['GymEnv', VecEnv]) -> Optional[VecNormalize]:
|
||||||
|
|
@ -3,8 +3,8 @@ from copy import deepcopy
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import VecEnv
|
from stable_baselines3.common.vec_env.base_vec_env import VecEnv
|
||||||
from torchy_baselines.common.vec_env.util import copy_obs_dict, dict_to_obs, obs_space_info
|
from stable_baselines3.common.vec_env.util import copy_obs_dict, dict_to_obs, obs_space_info
|
||||||
|
|
||||||
|
|
||||||
class DummyVecEnv(VecEnv):
|
class DummyVecEnv(VecEnv):
|
||||||
|
|
@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||||
import gym
|
import gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import VecEnv, CloudpickleWrapper
|
from stable_baselines3.common.vec_env.base_vec_env import VecEnv, CloudpickleWrapper
|
||||||
|
|
||||||
|
|
||||||
def _worker(remote, parent_remote, env_fn_wrapper):
|
def _worker(remote, parent_remote, env_fn_wrapper):
|
||||||
|
|
@ -3,7 +3,7 @@ import warnings
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import VecEnv, VecEnvWrapper
|
from stable_baselines3.common.vec_env.base_vec_env import VecEnv, VecEnvWrapper
|
||||||
|
|
||||||
|
|
||||||
class VecFrameStack(VecEnvWrapper):
|
class VecFrameStack(VecEnvWrapper):
|
||||||
|
|
@ -2,8 +2,8 @@ import pickle
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import VecEnvWrapper
|
from stable_baselines3.common.vec_env.base_vec_env import VecEnvWrapper
|
||||||
from torchy_baselines.common.running_mean_std import RunningMeanStd
|
from stable_baselines3.common.running_mean_std import RunningMeanStd
|
||||||
|
|
||||||
|
|
||||||
class VecNormalize(VecEnvWrapper):
|
class VecNormalize(VecEnvWrapper):
|
||||||
|
|
@ -2,11 +2,11 @@ import typing
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env.base_vec_env import VecEnv, VecEnvWrapper
|
from stable_baselines3.common.vec_env.base_vec_env import VecEnv, VecEnvWrapper
|
||||||
from torchy_baselines.common.preprocessing import is_image_space
|
from stable_baselines3.common.preprocessing import is_image_space
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from torchy_baselines.common.type_aliases import GymStepReturn
|
from stable_baselines3.common.type_aliases import GymStepReturn
|
||||||
|
|
||||||
|
|
||||||
class VecTransposeImage(VecEnvWrapper):
|
class VecTransposeImage(VecEnvWrapper):
|
||||||
2
stable_baselines3/ppo/__init__.py
Normal file
2
stable_baselines3/ppo/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
from stable_baselines3.ppo.ppo import PPO
|
||||||
|
from stable_baselines3.ppo.policies import MlpPolicy
|
||||||
|
|
@ -6,10 +6,10 @@ import torch as th
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.policies import (BasePolicy, register_policy, MlpExtractor,
|
from stable_baselines3.common.policies import (BasePolicy, register_policy, MlpExtractor,
|
||||||
create_sde_features_extractor, NatureCNN,
|
create_sde_features_extractor, NatureCNN,
|
||||||
BaseFeaturesExtractor, FlattenExtractor)
|
BaseFeaturesExtractor, FlattenExtractor)
|
||||||
from torchy_baselines.common.distributions import (make_proba_distribution, Distribution,
|
from stable_baselines3.common.distributions import (make_proba_distribution, Distribution,
|
||||||
DiagGaussianDistribution, CategoricalDistribution,
|
DiagGaussianDistribution, CategoricalDistribution,
|
||||||
StateDependentNoiseDistribution)
|
StateDependentNoiseDistribution)
|
||||||
|
|
||||||
|
|
@ -14,14 +14,14 @@ import torch.nn.functional as F
|
||||||
# SummaryWriter = None
|
# SummaryWriter = None
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common import logger
|
from stable_baselines3.common import logger
|
||||||
from torchy_baselines.common.base_class import BaseRLModel
|
from stable_baselines3.common.base_class import BaseRLModel
|
||||||
from torchy_baselines.common.type_aliases import GymEnv, MaybeCallback
|
from stable_baselines3.common.type_aliases import GymEnv, MaybeCallback
|
||||||
from torchy_baselines.common.buffers import RolloutBuffer
|
from stable_baselines3.common.buffers import RolloutBuffer
|
||||||
from torchy_baselines.common.utils import explained_variance, get_schedule_fn
|
from stable_baselines3.common.utils import explained_variance, get_schedule_fn
|
||||||
from torchy_baselines.common.vec_env import VecEnv
|
from stable_baselines3.common.vec_env import VecEnv
|
||||||
from torchy_baselines.common.callbacks import BaseCallback
|
from stable_baselines3.common.callbacks import BaseCallback
|
||||||
from torchy_baselines.ppo.policies import PPOPolicy
|
from stable_baselines3.ppo.policies import PPOPolicy
|
||||||
|
|
||||||
|
|
||||||
class PPO(BaseRLModel):
|
class PPO(BaseRLModel):
|
||||||
2
stable_baselines3/sac/__init__.py
Normal file
2
stable_baselines3/sac/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
from stable_baselines3.sac.sac import SAC
|
||||||
|
from stable_baselines3.sac.policies import MlpPolicy
|
||||||
|
|
@ -4,11 +4,11 @@ import gym
|
||||||
import torch as th
|
import torch as th
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
from torchy_baselines.common.preprocessing import get_action_dim
|
from stable_baselines3.common.preprocessing import get_action_dim
|
||||||
from torchy_baselines.common.policies import (BasePolicy, register_policy, create_mlp,
|
from stable_baselines3.common.policies import (BasePolicy, register_policy, create_mlp,
|
||||||
create_sde_features_extractor, NatureCNN,
|
create_sde_features_extractor, NatureCNN,
|
||||||
BaseFeaturesExtractor, FlattenExtractor)
|
BaseFeaturesExtractor, FlattenExtractor)
|
||||||
from torchy_baselines.common.distributions import SquashedDiagGaussianDistribution, StateDependentNoiseDistribution
|
from stable_baselines3.common.distributions import SquashedDiagGaussianDistribution, StateDependentNoiseDistribution
|
||||||
|
|
||||||
# CAP the standard deviation of the actor
|
# CAP the standard deviation of the actor
|
||||||
LOG_STD_MAX = 2
|
LOG_STD_MAX = 2
|
||||||
|
|
@ -4,11 +4,11 @@ import torch as th
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common import logger
|
from stable_baselines3.common import logger
|
||||||
from torchy_baselines.common.base_class import OffPolicyRLModel
|
from stable_baselines3.common.base_class import OffPolicyRLModel
|
||||||
from torchy_baselines.common.type_aliases import GymEnv, MaybeCallback
|
from stable_baselines3.common.type_aliases import GymEnv, MaybeCallback
|
||||||
from torchy_baselines.common.noise import ActionNoise
|
from stable_baselines3.common.noise import ActionNoise
|
||||||
from torchy_baselines.sac.policies import SACPolicy
|
from stable_baselines3.sac.policies import SACPolicy
|
||||||
|
|
||||||
|
|
||||||
class SAC(OffPolicyRLModel):
|
class SAC(OffPolicyRLModel):
|
||||||
2
stable_baselines3/td3/__init__.py
Normal file
2
stable_baselines3/td3/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
from stable_baselines3.td3.td3 import TD3
|
||||||
|
from stable_baselines3.td3.policies import MlpPolicy
|
||||||
|
|
@ -4,11 +4,11 @@ import gym
|
||||||
import torch as th
|
import torch as th
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
|
|
||||||
from torchy_baselines.common.preprocessing import get_action_dim
|
from stable_baselines3.common.preprocessing import get_action_dim
|
||||||
from torchy_baselines.common.policies import (BasePolicy, register_policy, create_mlp,
|
from stable_baselines3.common.policies import (BasePolicy, register_policy, create_mlp,
|
||||||
create_sde_features_extractor, NatureCNN,
|
create_sde_features_extractor, NatureCNN,
|
||||||
BaseFeaturesExtractor, FlattenExtractor)
|
BaseFeaturesExtractor, FlattenExtractor)
|
||||||
from torchy_baselines.common.distributions import StateDependentNoiseDistribution
|
from stable_baselines3.common.distributions import StateDependentNoiseDistribution
|
||||||
|
|
||||||
|
|
||||||
class Actor(BasePolicy):
|
class Actor(BasePolicy):
|
||||||
|
|
@ -2,11 +2,11 @@ import torch as th
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from typing import List, Tuple, Type, Union, Callable, Optional, Dict, Any
|
from typing import List, Tuple, Type, Union, Callable, Optional, Dict, Any
|
||||||
|
|
||||||
from torchy_baselines.common import logger
|
from stable_baselines3.common import logger
|
||||||
from torchy_baselines.common.base_class import OffPolicyRLModel
|
from stable_baselines3.common.base_class import OffPolicyRLModel
|
||||||
from torchy_baselines.common.noise import ActionNoise
|
from stable_baselines3.common.noise import ActionNoise
|
||||||
from torchy_baselines.common.type_aliases import GymEnv, MaybeCallback
|
from stable_baselines3.common.type_aliases import GymEnv, MaybeCallback
|
||||||
from torchy_baselines.td3.policies import TD3Policy
|
from stable_baselines3.td3.policies import TD3Policy
|
||||||
|
|
||||||
|
|
||||||
class TD3(OffPolicyRLModel):
|
class TD3(OffPolicyRLModel):
|
||||||
|
|
@ -4,8 +4,8 @@ import shutil
|
||||||
import pytest
|
import pytest
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.callbacks import (CallbackList, CheckpointCallback, EvalCallback,
|
from stable_baselines3.common.callbacks import (CallbackList, CheckpointCallback, EvalCallback,
|
||||||
EveryNTimesteps, StopTrainingOnRewardThreshold)
|
EveryNTimesteps, StopTrainingOnRewardThreshold)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import os
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.identity_env import FakeImageEnv
|
from stable_baselines3.common.identity_env import FakeImageEnv
|
||||||
|
|
||||||
SAVE_PATH = './cnn_model.zip'
|
SAVE_PATH = './cnn_model.zip'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
import torch as th
|
import torch as th
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('net_arch', [
|
@pytest.mark.parametrize('net_arch', [
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import pytest
|
import pytest
|
||||||
import torch as th
|
import torch as th
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO
|
from stable_baselines3 import A2C, PPO
|
||||||
from torchy_baselines.common.distributions import (DiagGaussianDistribution, TanhBijector,
|
from stable_baselines3.common.distributions import (DiagGaussianDistribution, TanhBijector,
|
||||||
StateDependentNoiseDistribution,
|
StateDependentNoiseDistribution,
|
||||||
CategoricalDistribution, SquashedDiagGaussianDistribution)
|
CategoricalDistribution, SquashedDiagGaussianDistribution)
|
||||||
from torchy_baselines.common.utils import set_random_seed
|
from stable_baselines3.common.utils import set_random_seed
|
||||||
|
|
||||||
|
|
||||||
N_ACTIONS = 2
|
N_ACTIONS = 2
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.identity_env import IdentityEnvBox, IdentityEnv
|
from stable_baselines3.common.identity_env import IdentityEnvBox, IdentityEnv
|
||||||
from torchy_baselines.common.evaluation import evaluate_policy
|
from stable_baselines3.common.evaluation import evaluate_policy
|
||||||
from torchy_baselines.common.noise import NormalActionNoise
|
from stable_baselines3.common.noise import NormalActionNoise
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("model_class", [A2C, PPO])
|
@pytest.mark.parametrize("model_class", [A2C, PPO])
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import shutil
|
||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.logger import (make_output_format, read_csv, read_json, DEBUG, ScopedConfigure,
|
from stable_baselines3.common.logger import (make_output_format, read_csv, read_json, DEBUG, ScopedConfigure,
|
||||||
info, debug, set_level, configure, logkv, logkvs,
|
info, debug, set_level, configure, logkv, logkvs,
|
||||||
dumpkvs, logkv_mean, warn, error, reset)
|
dumpkvs, logkv_mean, warn, error, reset)
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ KEY_VALUES = {
|
||||||
"g": np.array([[[1]]]),
|
"g": np.array([[[1]]]),
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DIR = '/tmp/torchy_baselines/'
|
LOG_DIR = '/tmp/stable_baselines3/'
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import os
|
||||||
import pandas
|
import pandas
|
||||||
import gym
|
import gym
|
||||||
|
|
||||||
from torchy_baselines.common.monitor import Monitor, get_monitor_files, load_results
|
from stable_baselines3.common.monitor import Monitor, get_monitor_files, load_results
|
||||||
|
|
||||||
|
|
||||||
def test_monitor(tmp_path):
|
def test_monitor(tmp_path):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import gym
|
import gym
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv
|
from stable_baselines3.common.vec_env import DummyVecEnv
|
||||||
|
|
||||||
MODEL_LIST = [
|
MODEL_LIST = [
|
||||||
PPO,
|
PPO,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
|
from stable_baselines3.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
|
||||||
|
|
||||||
normal_action_noise = NormalActionNoise(np.zeros(1), 0.1 * np.ones(1))
|
normal_action_noise = NormalActionNoise(np.zeros(1), 0.1 * np.ones(1))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch as th
|
import torch as th
|
||||||
|
|
||||||
from torchy_baselines import A2C, PPO, SAC, TD3
|
from stable_baselines3 import A2C, PPO, SAC, TD3
|
||||||
from torchy_baselines.common.identity_env import IdentityEnvBox
|
from stable_baselines3.common.identity_env import IdentityEnvBox
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv
|
from stable_baselines3.common.vec_env import DummyVecEnv
|
||||||
from torchy_baselines.common.identity_env import FakeImageEnv
|
from stable_baselines3.common.identity_env import FakeImageEnv
|
||||||
|
|
||||||
|
|
||||||
MODEL_LIST = [
|
MODEL_LIST = [
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import pytest
|
||||||
import torch as th
|
import torch as th
|
||||||
from torch.distributions import Normal
|
from torch.distributions import Normal
|
||||||
|
|
||||||
from torchy_baselines import A2C, TD3, SAC, PPO
|
from stable_baselines3 import A2C, TD3, SAC, PPO
|
||||||
|
|
||||||
|
|
||||||
def test_state_dependent_exploration_grad():
|
def test_state_dependent_exploration_grad():
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import pytest
|
||||||
import gym
|
import gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv, SubprocVecEnv, VecNormalize, VecFrameStack
|
from stable_baselines3.common.vec_env import DummyVecEnv, SubprocVecEnv, VecNormalize, VecFrameStack
|
||||||
|
|
||||||
N_ENVS = 3
|
N_ENVS = 3
|
||||||
VEC_ENV_CLASSES = [DummyVecEnv, SubprocVecEnv]
|
VEC_ENV_CLASSES = [DummyVecEnv, SubprocVecEnv]
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import gym
|
||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from torchy_baselines.common.running_mean_std import RunningMeanStd
|
from stable_baselines3.common.running_mean_std import RunningMeanStd
|
||||||
from torchy_baselines.common.vec_env import DummyVecEnv, VecNormalize, VecFrameStack, sync_envs_normalization, unwrap_vec_normalize
|
from stable_baselines3.common.vec_env import DummyVecEnv, VecNormalize, VecFrameStack, sync_envs_normalization, unwrap_vec_normalize
|
||||||
from torchy_baselines import SAC, TD3
|
from stable_baselines3 import SAC, TD3
|
||||||
|
|
||||||
ENV_ID = 'Pendulum-v0'
|
ENV_ID = 'Pendulum-v0'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from torchy_baselines.a2c.a2c import A2C
|
|
||||||
from torchy_baselines.ppo.policies import MlpPolicy
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from torchy_baselines.ppo.ppo import PPO
|
|
||||||
from torchy_baselines.ppo.policies import MlpPolicy
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from torchy_baselines.sac.sac import SAC
|
|
||||||
from torchy_baselines.sac.policies import MlpPolicy
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from torchy_baselines.td3.td3 import TD3
|
|
||||||
from torchy_baselines.td3.policies import MlpPolicy
|
|
||||||
Loading…
Reference in a new issue