Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running run_oracle.sh: SubprocVecEnv has no attribute 'env' #4

Open
songyuc opened this issue Dec 31, 2024 · 1 comment
Open

Comments

@songyuc
Copy link

songyuc commented Dec 31, 2024

Environment

  • OS: Linux
  • Python: 3.7.16
  • GPU: NVIDIA GeForce RTX 2080 Ti
  • CUDA: 12.4
  • Dependencies installed according to README.md (lines 22-41)

Description

I'm a student new to robotics and trying to run the Text2Reward project. When executing bash run_oracle.sh, I encountered the following error:

Traceback (most recent call last):
  File "ppo.py", line 161, in <module>
    success = np.array(ep_lens) < eval_env.env.env._max_episode_steps
AttributeError: 'SubprocVecEnv' object has no attribute 'env'

The error occurs when trying to access the _max_episode_steps attribute through nested env attributes of the vectorized environment.

Steps to Reproduce

  1. Set up environment following README.md instructions
  2. Run bash run_oracle.sh

Additional Context

  • I'm using the environment setup exactly as specified in:
## Dependencies
To establish the environment, run this code in the shell:
```shell
# set up conda
conda create -n text2reward python=3.7
conda activate text2reward
# set up ManiSkill2 environment
cd ManiSkill2
pip install -e .
pip install stable-baselines3==1.8.0 wandb tensorboard
cd ..
cd run_maniskill
bash download_data.sh
# set up MetaWorld environment
cd ..
cd Metaworld
pip install -e .
# set up code generation
pip install langchain chromadb==0.4.0
```
  • The vectorized environment is created as shown in:
        "# create one eval environment. Partial must be used here\n",
        "env_fn = partial(\n",
        "    make_env,\n",
        "    env_id,\n",
        "    record_dir=\"logs/videos\",\n",
        ")\n",
        "eval_env = SubprocVecEnv([env_fn for i in range(1)])\n",
        "eval_env = VecMonitor(eval_env) # attach this so SB3 can log reward metrics\n",
        "eval_env.seed(0)\n",

Questions

  1. What's causing this error?
  2. Could you help with solving this error?

I appreciate your help!

@sihengz02
Copy link
Collaborator

Apologies for the delayed response. I don’t check the issues in this repository very frequently. May I ask if this occurs only when you run bash run_oracle.sh, or does it also happen when you run bash run_zero_shot.sh or bash run_few_shot.sh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants