Skip to content

problem occurred when running the code #1

@Chuan1997

Description

@Chuan1997

when I run the code:
ModelCatalog.register_custom_model("MLPModel", MyKerasQModel)

obs_space = gym.spaces.Box(low=0, high=1, shape=(8,))
act_space = gym.spaces.Discrete(2)

def gen_policy(i):
config = {
"model": {
"custom_model": "MLPModel",
},
"gamma": 0.99,
}
return (None, obs_space, act_space, config)

policies = {"policy_0": gen_policy(0)}
policy_ids = list(policies.keys())

trainer = ray.rllib.agents.dqn.ApexTrainer(

trainer = ray.rllib.agents.dqn.DQNTrainer(
env="Game",
config={
"env_config": {},

    # General

"log_level": "ERROR",

    # Method specific
    "multiagent": {
        "policies": policies,
        "policy_mapping_fn": (
            lambda agent_id: policy_ids[0]),
    },
    "lr": 0.0005,
},

)

the return is:
ValueError: ('The given model must subclass', <class 'ray.rllib.agents.dqn.distributional_q_model.DistributionalQModel'>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions