2019-01-23 21:27:26 -08:00
|
|
|
from ray.rllib.utils.annotations import PublicAPI
|
2018-01-24 11:03:43 -08:00
|
|
|
|
2019-01-23 21:27:26 -08:00
|
|
|
|
|
|
|
@PublicAPI
|
2018-01-24 11:03:43 -08:00
|
|
|
class UnsupportedSpaceException(Exception):
|
|
|
|
"""Error for an unsupported action or observation space."""
|
2022-01-29 18:41:57 -08:00
|
|
|
|
2018-01-24 11:03:43 -08:00
|
|
|
pass
|
2021-09-02 09:28:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
@PublicAPI
|
|
|
|
class EnvError(Exception):
|
|
|
|
"""Error if we encounter an error during RL environment validation."""
|
2022-01-29 18:41:57 -08:00
|
|
|
|
2021-09-02 09:28:16 +02:00
|
|
|
pass
|
2021-09-10 16:52:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
# -------
|
|
|
|
# Error messages
|
|
|
|
# -------
|
|
|
|
|
|
|
|
# Message explaining there are no GPUs available for the
|
|
|
|
# num_gpus=n or num_gpus_per_worker=m settings.
|
2022-01-29 18:41:57 -08:00
|
|
|
ERR_MSG_NO_GPUS = """Found {} GPUs on your machine (GPU devices found: {})! If your machine
|
2021-09-10 16:52:47 +02:00
|
|
|
does not have any GPUs, you should set the config keys `num_gpus` and
|
|
|
|
`num_gpus_per_worker` to 0 (they may be set to 1 by default for your
|
|
|
|
particular RL algorithm)."""
|
|
|
|
|
2022-01-29 18:41:57 -08:00
|
|
|
ERR_MSG_INVALID_ENV_DESCRIPTOR = """The env string you provided ('{}') is:
|
2021-09-10 16:52:47 +02:00
|
|
|
a) Not a supported/installed environment.
|
|
|
|
b) Not a tune-registered environment creator.
|
|
|
|
c) Not a valid env class string.
|
|
|
|
|
|
|
|
Try one of the following:
|
[RLlib] Upgrade gym version to 0.21 and deprecate pendulum-v0. (#19535)
* Fix QMix, SAC, and MADDPA too.
* Unpin gym and deprecate pendulum v0
Many tests in rllib depended on pendulum v0,
however in gym 0.21, pendulum v0 was deprecated
in favor of pendulum v1. This may change reward
thresholds, so will have to potentially rerun
all of the pendulum v1 benchmarks, or use another
environment in favor. The same applies to frozen
lake v0 and frozen lake v1
Lastly, all of the RLlib tests and have
been moved to python 3.7
* Add gym installation based on python version.
Pin python<= 3.6 to gym 0.19 due to install
issues with atari roms in gym 0.20
* Reformatting
* Fixing tests
* Move atari-py install conditional to req.txt
* migrate to new ale install method
* Fix QMix, SAC, and MADDPA too.
* Unpin gym and deprecate pendulum v0
Many tests in rllib depended on pendulum v0,
however in gym 0.21, pendulum v0 was deprecated
in favor of pendulum v1. This may change reward
thresholds, so will have to potentially rerun
all of the pendulum v1 benchmarks, or use another
environment in favor. The same applies to frozen
lake v0 and frozen lake v1
Lastly, all of the RLlib tests and have
been moved to python 3.7
* Add gym installation based on python version.
Pin python<= 3.6 to gym 0.19 due to install
issues with atari roms in gym 0.20
Move atari-py install conditional to req.txt
migrate to new ale install method
Make parametric_actions_cartpole return float32 actions/obs
Adding type conversions if obs/actions don't match space
Add utils to make elements match gym space dtypes
Co-authored-by: Jun Gong <jungong@anyscale.com>
Co-authored-by: sven1977 <svenmika1977@gmail.com>
2021-11-03 08:24:00 -07:00
|
|
|
a) For Atari support: `pip install gym[atari] autorom[accept-rom-license]`.
|
2021-09-10 16:52:47 +02:00
|
|
|
For VizDoom support: Install VizDoom
|
|
|
|
(https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md) and
|
|
|
|
`pip install vizdoomgym`.
|
|
|
|
For PyBullet support: `pip install pybullet`.
|
|
|
|
b) To register your custom env, do `from ray import tune;
|
|
|
|
tune.register('[name]', lambda cfg: [return env obj from here using cfg])`.
|
|
|
|
Then in your config, do `config['env'] = [name]`.
|
|
|
|
c) Make sure you provide a fully qualified classpath, e.g.:
|
|
|
|
`ray.rllib.examples.env.repeat_after_me_env.RepeatAfterMeEnv`
|
|
|
|
"""
|
|
|
|
|
|
|
|
# -------
|
|
|
|
# HOWTO_ strings can be added to any error/warning/into message
|
|
|
|
# to eplain to the user, how to actually fix the encountered problem.
|
|
|
|
# -------
|
|
|
|
|
|
|
|
# HOWTO change the RLlib config, depending on how user runs the job.
|
|
|
|
HOWTO_CHANGE_CONFIG = """
|
|
|
|
To change the config for the `rllib train|rollout` command, use
|
|
|
|
`--config={'[key]': '[value]'}` on the command line.
|
|
|
|
To change the config for `tune.run()` in a script: Modify the python dict
|
|
|
|
passed to `tune.run(config=[...])`.
|
|
|
|
To change the config for an RLlib Trainer instance: Modify the python dict
|
|
|
|
passed to the Trainer's constructor, e.g. `PPOTrainer(config=[...])`.
|
|
|
|
"""
|