Пример #1
0
def _register_all():
    from ray.rllib.agents.trainer import Trainer, with_common_config
    from ray.rllib.agents.registry import ALGORITHMS, get_agent_class
    from ray.rllib.contrib.registry import CONTRIBUTED_ALGORITHMS

    for key in list(ALGORITHMS.keys()) + list(CONTRIBUTED_ALGORITHMS.keys(
    )) + ["__fake", "__sigmoid_fake_data", "__parameter_tuning"]:
        register_trainable(key, get_agent_class(key))

    def _see_contrib(name):
        """Returns dummy agent class warning algo is in contrib/."""

        class _SeeContrib(Trainer):
            _name = "SeeContrib"
            _default_config = with_common_config({})

            def setup(self, config):
                raise NameError(
                    "Please run `contrib/{}` instead.".format(name))

        return _SeeContrib

    # also register the aliases minus contrib/ to give a good error message
    for key in list(CONTRIBUTED_ALGORITHMS.keys()):
        assert key.startswith("contrib/")
        alias = key.split("/", 1)[1]
        register_trainable(alias, _see_contrib(alias))
Пример #2
0
def _register_all():

    from ray.rllib.agents.registry import ALGORITHMS
    from ray.rllib.contrib.registry import CONTRIBUTED_ALGORITHMS
    for key in list(ALGORITHMS.keys()) + list(CONTRIBUTED_ALGORITHMS.keys(
    )) + ["__fake", "__sigmoid_fake_data", "__parameter_tuning"]:
        from ray.rllib.agents.registry import get_agent_class
        register_trainable(key, get_agent_class(key))
Пример #3
0
def _register_all():

    from ray.rllib.agents.registry import ALGORITHMS
    from ray.rllib.contrib.registry import CONTRIBUTED_ALGORITHMS
    for key in list(ALGORITHMS.keys()) + list(CONTRIBUTED_ALGORITHMS.keys(
    )) + ["__fake", "__sigmoid_fake_data", "__parameter_tuning"]:
        from ray.rllib.agents.registry import get_agent_class
        register_trainable(key, get_agent_class(key))
Пример #4
0
                        type=str,
                        default="simple",
                        choices=scenarios.__all__,
                        help="Scenario selection, default is `simple`")
    parser.add_argument("--n_epoch",
                        type=int,
                        default=100,
                        help="Learning episodes.")
    parser.add_argument("--interval",
                        type=int,
                        default=20,
                        help="Save interval, defaut is 20.")
    parser.add_argument("--run",
                        type=str,
                        default="PG",
                        choices=set(ALGORITHMS.keys()))
    parser.add_argument("--share", action="store_true")
    parser.add_argument("--n_workers", type=int, default=2)
    parser.add_argument("--n_gpus", type=float, default=1.)
    parser.add_argument("--n_cpu_per_worker", type=float, default=0.)
    parser.add_argument("--s_batch_size", type=int, default=200)
    parser.add_argument("--t_batch_size", type=int, default=200)
    parser.add_argument("--config",
                        type=str,
                        default="simple_env_config.json",
                        help="Environment configuration filename.")

    args = parser.parse_args()

    env_config = utils.load_env_config(CONFIG_BACKUP, args.config)
    env = engine.Environment(env_config,
Пример #5
0
 def test_algo_import(self):
     for name, func in ALGORITHMS.items():
         func()