Closed lvjinqiao closed 3 years ago
Dear @lvjinqiao
Sorry for replying too late. I didn't manage this repository for a long time, so I find this issue just now.
I think you've reported this issue to the wrong repository. I found the same issue on https://github.com/Kautenja/nes-py/issues/71#issue-775855012 so I closed it.
Best Regards. zrma
I'm sorry, I can't speak English. I hope you can understand what I said. When I quoted your NES package, it seemed that there was an error in the program. I don't know if it was a problem with the NES package. I would like to ask you to take a look
""" @author: Viet Nguyen nhviet1009@gmail.com """
import gym_super_mario_bros from gym.spaces import Box from gym import Wrapper from nes_py.wrappers import JoypadSpace from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT, RIGHT_ONLY import cv2 import numpy as np import subprocess as sp import torch.multiprocessing as mp import time
class Monitor: def init(self, width, height, saved_path):
def process_frame(frame):
class CustomReward(Wrapper): def init(self, env=None, monitor=None): super(CustomReward, self).init(env) self.observation_space = Box(low=0, high=255, shape=(1, 84, 84)) self.curr_score = 0 if monitor: self.monitor = monitor else: self.monitor = None
class CustomSkipFrame(Wrapper): def init(self, env, skip=4): super(CustomSkipFrame, self).init(env) self.observation_space = Box(low=0, high=255, shape=(skip, 84, 84)) self.skip = skip self.states = np.zeros((skip, 84, 84), dtype=np.float32)
def create_train_env(world, stage, actions, output_path=None): env = gym_super_mario_bros.make("SuperMarioBros-{}-{}-v0".format(world, stage)) if output_path: monitor = Monitor(256, 240, output_path) else: monitor = None
def test(): return "11111111111111111"
class MultipleEnvironments: def init(self, world, stage, action_type, num_envs, output_path=None): self.agent_conns, self.envconns = zip(*[mp.Pipe() for in range(num_envs)]) if action_type == "right": actions = RIGHT_ONLY elif action_type == "simple": actions = SIMPLE_MOVEMENT else: actions = COMPLEX_MOVEMENT
if name == 'main': envs = MultipleEnvironments(5, 2, "simple", 2)
D:\Pycharm\Project\venv\Scripts\python.exe C:/Users/LV/Desktop/Super-mario-bros-PPO-pytorch-master/src/env.py 8408 14212 Process Process-1: Traceback (most recent call last): File "D:\python\lib\multiprocessing\process.py", line 297, in _bootstrap self.run() File "D:\python\lib\multiprocessing\process.py", line 99, in run self._target(*self._args, self._kwargs) File "C:\Users\LV\Desktop\Super-mario-bros-PPO-pytorch-master\src\env.py", line 156, in run self.env_conns[index].send(self.envs[index].reset()) File "C:\Users\LV\Desktop\Super-mario-bros-PPO-pytorch-master\src\env.py", line 95, in reset state = self.env.reset() File "C:\Users\LV\Desktop\Super-mario-bros-PPO-pytorch-master\src\env.py", line 68, in reset return process_frame(self.env.reset()) File "D:\python\lib\site-packages\nes_py\wrappers\joypad_space.py", line 78, in reset return self.env.reset() File "D:\python\lib\site-packages\gym\wrappers\time_limit.py", line 25, in reset return self.env.reset(kwargs) File "D:\python\lib\site-packages\nes_py\nes_env.py", line 258, in reset self._restore() File "D:\python\lib\site-packages\nes_py\nes_env.py", line 220, in _restore _LIB.Restore(self._env) OSError: exception: access violation reading 0x0000016262170760