boyu-ai/Hands-on-RL

20章的代码问题

Opened this issue · 3 comments

image 你好,请问这种情况怎么解决呢?是20章的代码问题

请问你在最开始加载ma-gym环境时遇到了这个问题吗?

{
"name": "AttributeError",
"message": "'EnvSpec' object has no attribute 'entry_point'",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/corneliusdeng/UESTC/Dive Into RL/IPPO.ipynb Cell 1 line 1
9 import sys
10 sys.path.append("./ma-gym")
---> 11 from ma_gym.envs.combat.combat import Combat

File ~/UESTC/Dive Into RL/./ma-gym/ma_gym/init.py:10
6 logger = logging.getLogger(name)
8 # Register openai's environments as multi agent
9 # This should be done before registering new environments
---> 10 env_specs = [env_spec for env_spec in envs.registry.all() if 'gym.envs' in env_spec.entry_point]
11 for spec in env_specs:
12 register(
13 id='ma_' + spec.id,
14 entry_point='ma_gym.envs.openai:MultiAgentWrapper',
15 kwargs={'name': spec.id, **spec._kwargs}
16 )

File ~/UESTC/Dive Into RL/./ma-gym/ma_gym/init.py:10, in (.0)
6 logger = logging.getLogger(name)
8 # Register openai's environments as multi agent
9 # This should be done before registering new environments
---> 10 env_specs = [env_spec for env_spec in envs.registry.all() if 'gym.envs' in env_spec.entry_point]
11 for spec in env_specs:
12 register(
13 id='ma_' + spec.id,
14 entry_point='ma_gym.envs.openai:MultiAgentWrapper',
15 kwargs={'name': spec.id, **spec._kwargs}
16 )

AttributeError: 'EnvSpec' object has no attribute 'entry_point'"
}

请问你在最开始加载ma-gym环境时遇到了这个问题吗?

{ "name": "AttributeError", "message": "'EnvSpec' object has no attribute 'entry_point'", "stack": "--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /Users/corneliusdeng/UESTC/Dive Into RL/IPPO.ipynb Cell 1 line 1 9 import sys 10 sys.path.append("./ma-gym") ---> 11 from ma_gym.envs.combat.combat import Combat

File ~/UESTC/Dive Into RL/./ma-gym/ma_gym/init.py:10 6 logger = logging.getLogger(name) 8 # Register openai's environments as multi agent 9 # This should be done before registering new environments ---> 10 env_specs = [env_spec for env_spec in envs.registry.all() if 'gym.envs' in env_spec.entry_point] 11 for spec in env_specs: 12 register( 13 id='ma_' + spec.id, 14 entry_point='ma_gym.envs.openai:MultiAgentWrapper', 15 kwargs={'name': spec.id, **spec._kwargs} 16 )

File ~/UESTC/Dive Into RL/./ma-gym/ma_gym/init.py:10, in (.0) 6 logger = logging.getLogger(name) 8 # Register openai's environments as multi agent 9 # This should be done before registering new environments ---> 10 env_specs = [env_spec for env_spec in envs.registry.all() if 'gym.envs' in env_spec.entry_point] 11 for spec in env_specs: 12 register( 13 id='ma_' + spec.id, 14 entry_point='ma_gym.envs.openai:MultiAgentWrapper', 15 kwargs={'name': spec.id, **spec._kwargs} 16 )

AttributeError: 'EnvSpec' object has no attribute 'entry_point'" }

你好,我在加载的时候没有问题,是图片中那里出现的问题

你好 请问keyerror这个问题是怎么解决的呀 我也遇到这个问题了