You were right. I changed my config file to this:
policies= {
"policy_" + str(i): (None , game.agents[i].observation_space , game.agents[i].action_space , {}) for i in range(0,game.num_agents)
}
def policy_mapping_fn (agent_id: str):
assert agent_id in [str(i) for i in range(0,20)], f"ERROR: invalid agent id {agent_id}!!!"
return "policy_" + agent_id
config={
"num_workers": 4,
"create_env_on_driver": True,
"multiagent": {
"policies": policies,
"policy_mapping_fn": policy_mapping_fn,
},
}
But I still get the following error:
Failure # 1 (occurred at 2022-02-17_15-17-46)
Traceback (most recent call last):
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trial_runner.py", line 924, in _process_trial
results = self.trial_executor.fetch_result(trial)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\ray_trial_executor.py", line 787, in fetch_result
result = ray.get(trial_future[0], timeout=DEFAULT_GET_TIMEOUT)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\worker.py", line 1713, in get
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(ValueError): e[36mray::PPO.train_buffered()e[39m (pid=8892, ip=127.0.0.1, repr=PPO)
File "python\ray\_raylet.pyx", line 625, in ray._raylet.execute_task
File "python\ray\_raylet.pyx", line 629, in ray._raylet.execute_task
File "python\ray\_raylet.pyx", line 578, in ray._raylet.execute_task.function_executor
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\_private\function_manager.py", line 609, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trainable.py", line 255, in train_buffered
result = self.train()
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trainable.py", line 314, in train
result = self.step()
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\rllib\agents\trainer.py", line 880, in step
raise e
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\rllib\agents\trainer.py", line 867, in step
result = self.step_attempt()
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\rllib\agents\trainer.py", line 920, in step_attempt
step_results = next(self.train_exec_impl)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 756, in __next__
return next(self.built_iterator)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 843, in apply_filter
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 843, in apply_filter
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
[Previous line repeated 1 more time]
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 876, in apply_flatten
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 783, in apply_foreach
for item in it:
[Previous line repeated 1 more time]
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 471, in base_iterator
yield ray.get(futures, timeout=timeout)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\worker.py", line 1713, in get
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(ValueError): e[36mray::RolloutWorker.par_iter_next()e[39m (pid=8100, ip=127.0.0.1, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x000001D3DCA7FD90>)
File "python\ray\_raylet.pyx", line 625, in ray._raylet.execute_task
File "python\ray\_raylet.pyx", line 629, in ray._raylet.execute_task
File "python\ray\_raylet.pyx", line 578, in ray._raylet.execute_task.function_executor
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\_private\function_manager.py", line 609, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\iter.py", line 1151, in par_iter_next
return next(self.local_it)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\rllib\evaluation\rollout_worker.py", line 381, in gen_rollouts
yield self.sample()
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\util\tracing\tracing_helper.py", line 451, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\mohazaa1\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\rllib\evaluation\rollout_worker.py", line 749, in sample
raise ValueError("RolloutWorker has no `input_reader` object! "
ValueError: RolloutWorker has no `input_reader` object! Cannot call `sample()`. You can try setting `create_env_on_driver` to True.