Code Monkey home page Code Monkey logo

Comments (1)

destin-v avatar destin-v commented on July 1, 2024

Upon further investigation I discovered what triggers the error. Below is a simple example of CartPole-v1 where this error shows up. If you add the input argument policies_to_train=["p0"] to the PPOConfig it will error out. If you do not add policies_to_train=["p0"], it will run.

ppo_config = (
                PPOConfig()
                .environment(MultiAgentCartPole, env_config={"num_agents": 2})
                # Switch both the new API stack flags to True (both False by default).
                # This enables the use of:
                # a) RLModule (replaces ModelV2) and Learner (replaces Policy)
                # b) and automatically picks the correct EnvRunner (single-agent vs multi-agent) and enables ConnectorV2 support.
                .api_stack(
                    enable_rl_module_and_learner=True,
                    enable_env_runner_and_connector_v2=True,
                )
                .resources(
                    num_cpus_for_main_process=16,
                )
                # supports arbitrary scaling on the learner axis, feel free to set
                # `num_learners` to the number of available GPUs for multi-GPU training (and `num_gpus_per_learner=1`).
                .learners(
                    num_learners=0,  # <- set this value to the number of GPUs
                    num_gpus_per_learner=0,  # <- set this to 1, if you have a GPU
                )
                .training(train_batch_size_per_learner=5000)
                # Because you are in a multi-agent env, you have to set up the usual multi-agent parameters:
                .multi_agent(
                    policies={"p0", "p1"},
                    # Map agent 0 to p0 and agent 1 to p1.
                    policy_mapping_fn=lambda agent_id, episode, **kwargs: f"p{agent_id}",
                    policies_to_train=["p0"],
                )
            )

from ray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.