Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem occurred when running the code #1

Open
Chuan1997 opened this issue Jun 26, 2020 · 0 comments
Open

problem occurred when running the code #1

Chuan1997 opened this issue Jun 26, 2020 · 0 comments

Comments

@Chuan1997
Copy link

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'>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant