uvipen / Super-mario-bros-PPO-pytorch

Proximal Policy Optimization (PPO) algorithm for Super Mario Bros
MIT License
1.07k stars 200 forks source link

AttributeError: 'Monitor' object has no attribute 'pipe' #19

Open VicenHe opened 2 years ago

VicenHe commented 2 years ago

While testing the model i get this: Traceback (most recent call last): File "test.py", line 65, in test(opt) File "test.py", line 55, in test state, reward, done, info = env.step(action) File "C:\Users\johnm\DeepLearning\Super-mario-bros-PPO-pytorch\src\env.py", line 100, in step state, reward, done, info = self.env.step(action) File "C:\Users\johnm\DeepLearning\Super-mario-bros-PPO-pytorch\src\env.py", line 55, in step self.monitor.record(state) File "C:\Users\johnm\DeepLearning\Super-mario-bros-PPO-pytorch\src\env.py", line 27, in record self.pipe.stdin.write(image_array.tostring()) AttributeError: 'Monitor' object has no attribute 'pipe' Can you help please?

TheBeautifulMoonlight commented 2 years ago

I met the same issue at test. So I found the problem is in /src/env.py Class Monitor. And the reason is that we did not install ffmpeg. So the Monitor didn't create self.pipe. To solve this problem we can Install ffmpeg or Block the class Monitor.

Liuchaochao7 commented 2 years ago

I met the same issue at test. So I found the problem is in /src/env.py Class Monitor. And the reason is that we did not install ffmpeg. So the Monitor didn't create self.pipe. To solve this problem we can Install ffmpeg or Block the class Monitor.

Hey, my bro, I met the same problem, and I installed ffmpeg, but the problem is still exists. How did you install ffmpeg? pip install ffmpeg?

wenjian11 commented 4 months ago

Comment out the lines in the create_train_env method in the env.py file:

# if output_path:
#     monitor = Monitor(256, 240, output_path)
# else:
#     monitor = None

and add monitor = None.

wenjian11 commented 4 months ago

Comment out the lines in the create_train_env method in the env.py file:

# if output_path:
#     monitor = Monitor(256, 240, output_path)
# else:
#     monitor = None

and add monitor = None.

第二种方法参考:https://blog.csdn.net/m0_47449768/article/details/130102406