Search code examples
python-3.xwindows-subsystem-for-linuxopenai-gymvirtualenvwrapper

AttributeError: 'AtariEnv' object has no attribute '_get_ram'


I am trying to return a dataset of RAM values within the emulation of the Atari 2600. This is Minimum Viable code for the issue:

  envs = [
        supersuit.frame_stack_v1(gym.wrappers.AtariPreprocessing(gym.make(f'{env_name}NoFrameskip-v0')))
        for _ in range(num_envs)
    ]
    episodes_run = 0


    obs = onp.array([env.reset() for env in envs])
    pos = 0
    while pos < dataset_size:
        rng, epsilon_actions, q_values, actions = select_actions(obs, network_def, network_params, network_args,
                                                                 rng, epsilon, num_actions, num_envs)

        for env_num, env in enumerate(envs):
            new_obs, _, done, _ = env.step(actions[env_num])

            if not epsilon_actions[env_num]:
                ram_obs_dataset[pos] = env.unwrapped._get_ram()


                pos += 1
                if pos == dataset_size:
                    break

            if done:
                new_obs = env.reset()
                episodes_run += 1
            obs[env_num] = new_obs

    return  ram_obs_dataset

This is the screenshot of the error message

Also I am using WSL2 to handle linux only libraries like jaxlib etc.


Solution

  • try to replace env.unwrapped._get_ram() with env.ale.getRAM().