Open meici2023 opened 1 year ago
我也碰到了这个问题。最神奇的是我一开始能跑的,后来不知怎么的突然不能跑了。
重新装一下环境后又可以运行了。可以试一下重新建一个conda环境。
我也是遇到了相似的问题,请问您的目前解决了么?
我问了chatGPT,说是代码与模型不符,让我检查模型啥的,不懂,以下是报错的代码:
(StreetFighterAI) C:\Users\jiaxin\StreetFighterAI\street-fighter-ai-master\main>python test.py
Wrapping the env with a Monitor
wrapper
Wrapping the env in a DummyVecEnv.
Wrapping the env in a VecTransposeImage.
Traceback (most recent call last):
File "test.py", line 53, in
我也遇到了相同的问题,重新建了虚拟环境还是不行,请问有什么解决方案吗?
/home/xrb280/anaconda3/envs/StreetFighterAI2/lib/python3.8/site-packages/stable_baselines3/common/save_util.py:166: UserWarning: Could not deserialize object observation_space. Consider using custom_objects
argument to replace this object.
Exception: __randomstate_ctor() takes from 0 to 1 positional arguments but 2 were given
warnings.warn(
Traceback (most recent call last):
File "test.py", line 55, in
我也是我也是,这个问题咋办呀,解决了滴滴我一下
如果KeyError: "The observation_space and action_space were not given, can't verify new environments"报错的话, 将test.py的52~53行换成如下即可解决:
# 参考https://github.com/linyiLYi/street-fighter-ai/issues/16#issuecomment-1515463967
# if not RANDOM_ACTION:
# # 如果是你自己训练的模型
# model = PPO.load(os.path.join(MODEL_DIR, MODEL_NAME), env=env)
if not RANDOM_ACTION:
# 如果你使用的是linyiLYi提供的模型
keys = ['high', 'low', 'bounded_above', 'bounded_below']
setattr(env.observation_space, '_shape', (3,100,128))
for k in keys:
new_attr = getattr(env.observation_space, k).reshape(3,100,128)
setattr(env.observation_space, k, new_attr)
model = PPO.load(os.path.join(MODEL_DIR, MODEL_NAME), env=env,
custom_objects = {'observation_space': env.observation_space, 'action_space': env.action_space})