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 · 6 comments
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?

@songyuc
Copy link
Author

songyuc commented Jan 19, 2025

I just run bash run_oracle.sh, and have not tried bash run_zero_shot.sh or bash run_few_shot.sh yet.

@sihengz02
Copy link
Collaborator

Could you plz have a try and see whether you encounter the same issue?

@songyuc
Copy link
Author

songyuc commented Jan 19, 2025

I tried running run_zero_shot.sh as suggested but encountered an error. The error appears to be related to Wandb permissions:

wandb: Using wandb-core as the SDK backend.
wandb: Currently logged in as: songyuc. Use `wandb login --relogin` to force relogin
wandb: ERROR failed to upsert bucket: returned error 403 Forbidden: {"errors":[{"message":"permission denied","path":["upsertBucket"],"extensions":{"code":"PERMISSION_ERROR"}}],"data":{"upsertBucket":null}}

Traceback (most recent call last):
  File "ppo.py", line 116, in <module>
    settings=None if args.reward_path is None else wandb.Settings(code_dir=args.reward_path[:-11]))
[...]
wandb.errors.errors.CommError: failed to upsert bucket: returned error 403 Forbidden: {"errors":[{"message":"permission denied","path":["upsertBucket"],"extensions":{"code":"PERMISSION_ERROR"}}],"data":{"upsertBucket":null}}

Even though I'm logged into wandb, it seems there's a permission issue when trying to create or update the bucket. Could you please advise:

  1. Is wandb logging required for running these scripts?
  2. If required, what permissions do I need to set up in wandb?
  3. Is there a way to run the scripts without wandb logging?

Thank you for your help!

@sihengz02
Copy link
Collaborator

  1. Not required.
  2. You can refer to the documents of wandb.
  3. Just comment the codes that involve wandb. It's quite straightforward.

@songyuc
Copy link
Author

songyuc commented Jan 20, 2025

After a trial, I found that running run_zero_shot.sh would have a similar error.

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