-
Notifications
You must be signed in to change notification settings - Fork 60
Add Env EB-Alfred #90
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
c8d8b1d
1ef03b9
14c67f1
1ff784c
e27fbe4
7ad072d
7327cfc
64ff6f9
5b458c8
068dede
24d5de4
ef9dd73
d5e0c64
f3723e4
ea2ae53
c5c08f1
1ce537e
b767361
698a3f4
fcdb7e9
9639f0b
f869c15
137a9d6
192fa72
39c31b1
39f8373
545e1d5
793b952
a101871
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| fileroot: ${oc.env:HOME}/projects/vagen | ||
|
|
||
| envs: | ||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_val_common | ||
| seed: [0, 50, 1] | ||
| max_turns: 6 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: common_sense | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
| chat_config: | ||
| temperature: 0 | ||
| max_tokens: 2048 | ||
| top_p: 1.0 | ||
|
|
||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_val_spatial | ||
| seed: [0, 50, 1] | ||
| max_turns: 6 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: spatial | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
| chat_config: | ||
| temperature: 0 | ||
| max_tokens: 2048 | ||
| top_p: 1.0 | ||
|
|
||
| experiment: | ||
| dump_dir: ${fileroot}/rollouts/eval_eb_alfred | ||
| default_max_turns: 6 | ||
|
|
||
| run: | ||
| backend: "openai" | ||
| base_seed: 0 | ||
| max_concurrent_jobs: 4 | ||
| resume: skip_completed | ||
| live_summary: true | ||
|
|
||
| backends: | ||
| openai: | ||
| api_key: "" # or env OPENAI_API_KEY | ||
| base_url: null | ||
| model: "gpt-4o-mini" | ||
| max_concurrency: 2 | ||
| max_retries: 6 | ||
| min_backoff: 0.5 | ||
| max_backoff: 8.0 | ||
|
|
||
| sglang: | ||
| base_url: "http://127.0.0.1:30000/v1" | ||
| api_key: "EMPTY" | ||
| model: "Qwen/Qwen2.5-VL-7B-Instruct" | ||
| max_concurrency: 2 | ||
| max_retries: 6 | ||
| min_backoff: 0.5 | ||
| max_backoff: 8.0 | ||
|
|
||
| claude: | ||
| api_key: "" | ||
| base_url: null | ||
| model: "claude-3-5-sonnet-latest" | ||
| max_concurrency: 2 | ||
| max_retries: 6 | ||
| min_backoff: 0.5 | ||
| max_backoff: 8.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Before running, start the eb_alfred server in another terminal: | ||
| # python -m vagen.envs.eb_alfred.serve | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| CONFIG="${1:-$SCRIPT_DIR/config.yaml}" | ||
| shift 2>/dev/null || true | ||
|
|
||
| LOG_FILE="run.log" | ||
|
|
||
| python -m vagen.evaluate.run_eval --config "$CONFIG" "$@" \ | ||
| 2>&1 | tee "${LOG_FILE}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| envs: | ||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_train_base | ||
| seed: [0, 200, 1] | ||
| max_turns: 6 | ||
| response_length_per_turn: 512 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: base | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
|
|
||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_train_complex | ||
| seed: [0, 200, 1] | ||
| max_turns: 6 | ||
| response_length_per_turn: 512 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: complex_instruction | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
|
|
||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_train_visual | ||
| seed: [0, 200, 1] | ||
| max_turns: 6 | ||
| response_length_per_turn: 512 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: visual_appearance | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -x | ||
|
|
||
|
Comment on lines
+1
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enable As written, Proposed fix-#!/bin/bash
-
-set -x
+#!/bin/bash
+set -euo pipefail
+set -xAlso applies to: 85-86 🤖 Prompt for AI Agents |
||
| PROJECT_NAME="vagen_experiments" | ||
| EXPERIMENT_NAME="ppo_eb_alfred_no_concat" | ||
|
|
||
| BASEDIR=$(pwd) | ||
| SCRIPTDIR=$(dirname "$0") | ||
| EXPERIMENT_DIR=${BASEDIR}/exps/${PROJECT_NAME}/${EXPERIMENT_NAME} | ||
| SAVE_CHECKPOINT_DIR=${EXPERIMENT_DIR}/verl_checkpoints | ||
| DATASET_TRAIN=${SCRIPTDIR}/train_eb_alfred_vision.yaml | ||
| DATASET_VAL=${SCRIPTDIR}/val_eb_alfred_vision.yaml | ||
| agent_loop_config_path=${BASEDIR}/vagen/configs/agent_no_concat.yaml | ||
| REF_MODEL_PATH=Qwen/Qwen2.5-VL-3B-Instruct | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stop deriving repo paths from the caller's working directory.
Also applies to: 21-23 🤖 Prompt for AI Agents |
||
| mkdir -p ${EXPERIMENT_DIR} | ||
|
|
||
| export HF_HOME=/workspace/.hf_home | ||
| export PATH=/venv/vagen/bin:$PATH | ||
|
|
||
| PYTHONUNBUFFERED=1 python3 -m vagen.main_ppo \ | ||
| --config-path=${BASEDIR}/vagen/configs \ | ||
| --config-name='vagen_multiturn' \ | ||
| data.train_files=${DATASET_TRAIN} \ | ||
| data.val_files=${DATASET_VAL} \ | ||
| data.train_batch_size=128 \ | ||
| data.max_prompt_length=2048 \ | ||
| data.max_response_length=512 \ | ||
| +data.max_trajectory_length=7000 \ | ||
| algorithm.adv_estimator=no_concat_gae_first \ | ||
| algorithm.kl_ctrl.kl_coef=0.0 \ | ||
| actor_rollout_ref.model.path=${REF_MODEL_PATH} \ | ||
| actor_rollout_ref.model.use_remove_padding=True \ | ||
| actor_rollout_ref.model.use_fused_kernels=True \ | ||
| actor_rollout_ref.model.enable_gradient_checkpointing=True \ | ||
| actor_rollout_ref.actor.optim.lr=1e-6 \ | ||
| actor_rollout_ref.actor.ppo_mini_batch_size=32 \ | ||
| actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1 \ | ||
| actor_rollout_ref.actor.use_kl_loss=False \ | ||
| actor_rollout_ref.actor.kl_loss_coef=0.0 \ | ||
| actor_rollout_ref.actor.kl_loss_type=low_var_kl \ | ||
| actor_rollout_ref.actor.entropy_coeff=0.0 \ | ||
| actor_rollout_ref.actor.checkpoint.save_contents=['model','hf_model','optimizer','extra'] \ | ||
| actor_rollout_ref.actor.ulysses_sequence_parallel_size=1 \ | ||
| actor_rollout_ref.actor.fsdp_config.param_offload=True \ | ||
| actor_rollout_ref.actor.fsdp_config.optimizer_offload=True \ | ||
| actor_rollout_ref.actor.freeze_vision_tower=True \ | ||
| actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=1 \ | ||
| actor_rollout_ref.rollout.tensor_model_parallel_size=1 \ | ||
| actor_rollout_ref.rollout.name=sglang \ | ||
| actor_rollout_ref.rollout.mode=async \ | ||
| actor_rollout_ref.rollout.n=1 \ | ||
| actor_rollout_ref.rollout.max_num_batched_tokens=10000 \ | ||
| actor_rollout_ref.rollout.gpu_memory_utilization=0.6 \ | ||
| actor_rollout_ref.rollout.enforce_eager=True \ | ||
| actor_rollout_ref.rollout.free_cache_engine=True \ | ||
| actor_rollout_ref.rollout.enable_chunked_prefill=True \ | ||
| actor_rollout_ref.rollout.multi_turn.enable=True \ | ||
| actor_rollout_ref.rollout.agent.agent_loop_config_path=$agent_loop_config_path \ | ||
| actor_rollout_ref.rollout.disable_log_stats=False \ | ||
| actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=1 \ | ||
| actor_rollout_ref.ref.fsdp_config.param_offload=True \ | ||
| critic.enable=True \ | ||
| critic.optim.lr=1e-5 \ | ||
| critic.model.use_remove_padding=True \ | ||
| critic.model.path=${REF_MODEL_PATH} \ | ||
| critic.model.enable_gradient_checkpointing=True \ | ||
| critic.ppo_micro_batch_size_per_gpu=1 \ | ||
| critic.model.fsdp_config.param_offload=True \ | ||
| critic.model.fsdp_config.optimizer_offload=True \ | ||
| trainer.critic_warmup=0 \ | ||
| trainer.logger=['console','wandb'] \ | ||
| trainer.val_before_train=True \ | ||
| trainer.n_gpus_per_node=4 \ | ||
| trainer.nnodes=1 \ | ||
| trainer.save_freq=100 \ | ||
| trainer.test_freq=20 \ | ||
| trainer.project_name=${PROJECT_NAME} \ | ||
| trainer.experiment_name=${EXPERIMENT_NAME} \ | ||
| trainer.default_local_dir=${SAVE_CHECKPOINT_DIR} \ | ||
| trainer.validation_data_dir=${EXPERIMENT_DIR}/validation \ | ||
| trainer.rollout_data_dir=${EXPERIMENT_DIR}/rollout_data \ | ||
| trainer.log_val_generations=32 \ | ||
| +trainer.concat_multi_turn=False \ | ||
| trainer.total_training_steps=400 2>&1 | \ | ||
| tee ${EXPERIMENT_DIR}/${PROJECT_NAME}_${EXPERIMENT_NAME}.log >(tee ${BASEDIR}/${PROJECT_NAME}_${EXPERIMENT_NAME}.log >/dev/null) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| envs: | ||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_val_common | ||
| seed: [0, 50, 1] | ||
| max_turns: 6 | ||
| response_length_per_turn: 512 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: common_sense | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
|
|
||
| - name: RemoteEnv | ||
| n_envs: 50 | ||
| data_source: eb_alfred | ||
| tag_id: eb_alfred_val_spatial | ||
| seed: [0, 50, 1] | ||
| max_turns: 6 | ||
| response_length_per_turn: 512 | ||
| config: | ||
| base_urls: | ||
| - "http://localhost:8000" | ||
| timeout: 600 | ||
| eval_set: spatial | ||
| obs_image_size: 500 | ||
| max_turns: 6 | ||
| max_actions_per_step: 20 | ||
| max_env_steps: 30 | ||
| action_sep: "," | ||
| prompt_format: free_think | ||
| use_example_in_sys_prompt: true | ||
| format_reward: 0.1 | ||
| success_reward: 1.0 | ||
|
Comment on lines
+2
to
+44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # EB-ALFRED Environment | ||
|
|
||
| AI2-THOR based household robot task environment from [EmbodiedBench](https://github.com/EmbodiedBench/EmbodiedBench). The agent receives egocentric RGB images and executes multi-step tasks (cleaning, heating, slicing, storing objects). | ||
|
|
||
| ## Running the Service | ||
|
|
||
| The environment runs on a **separate GPU machine** with a physical or virtual display. AI2-THOR requires X11 rendering (CloudRendering is not supported on ai2thor 2.1.0). | ||
|
|
||
| **One-time setup — create the conda environment:** | ||
|
|
||
| ```bash | ||
| conda create -n embodiedbench python=3.9 -y | ||
| conda activate embodiedbench | ||
|
|
||
| git clone https://github.com/EmbodiedBench/EmbodiedBench.git /root/EmbodiedBench | ||
| touch /root/EmbodiedBench/embodiedbench/__init__.py | ||
| pip install -e /root/EmbodiedBench | ||
|
|
||
| pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126 | ||
| pip install "ai2thor==2.1.0" "gym==0.23.0" "numpy<2.0" \ | ||
| scipy Pillow networkx revtok vocab h5py tqdm natsort pyquaternion | ||
| pip install "flask==1.1.4" "werkzeug==1.0.1" \ | ||
| "markupsafe<2.1" "jinja2<3.0" "itsdangerous<2.0" | ||
| pip install "opencv-python-headless<4.9" | ||
| ``` | ||
|
|
||
| **Download dataset** (`eval_set` selects the split: `base` — standard tasks, `long` — longer horizon): | ||
|
|
||
| ```bash | ||
| git clone https://huggingface.co/datasets/EmbodiedBench/EB-ALFRED | ||
| mv EB-ALFRED /root/EmbodiedBench/embodiedbench/envs/eb_alfred/data/json_2.1.0 | ||
| ``` | ||
|
|
||
| **Start the server** (GPUs and Xorg are auto-detected and started): | ||
|
|
||
| ```bash | ||
| conda activate embodiedbench | ||
| python -m vagen.envs.eb_alfred.serve | ||
| ``` | ||
|
|
||
| Key parameters: | ||
| - `devices`: GPU indices (default: auto-detect via `CUDA_VISIBLE_DEVICES` or `nvidia-smi`) | ||
| - `capacity`: max concurrent Unity environments (default: 16) | ||
| - `startup_concurrency`: max Unity processes starting simultaneously, prevents CPU spikes (default: 8) | ||
| - `session_timeout`: idle session cleanup in seconds (default: 3600) | ||
|
|
||
| ```bash | ||
| # Example: 2 GPUs, higher capacity | ||
| python -m vagen.envs.eb_alfred.serve --devices='[0,1]' --capacity=90 --startup_concurrency=6 --port=8000 | ||
| ``` | ||
|
|
||
| **SSH tunnel** (if training machine is remote): | ||
|
|
||
| ```bash | ||
| # Run on the env server — forwards port 8000 to training machine | ||
| ssh -p <PORT> -R 8000:localhost:8000 \ | ||
| -o ServerAliveInterval=30 -o ServerAliveCountMax=5 \ | ||
| -N -f user@training-machine-ip | ||
|
|
||
| # On training machine, allow many tunnels — add to /etc/ssh/sshd_config: | ||
| # MaxSessions 200 | ||
| # then: service ssh reload | ||
| ``` | ||
|
|
||
| ## Evaluation | ||
|
|
||
| ```bash | ||
| conda activate vagen | ||
|
|
||
| # Terminal 1 (env server): start service | ||
| python -m vagen.envs.eb_alfred.serve --devices='[0,1]' --capacity=90 | ||
|
|
||
| # Terminal 2 (training machine): run eval | ||
| python -m vagen.evaluate.run_eval --config examples/evaluate/eb_alfred/config.yaml | ||
| ``` | ||
|
|
||
| Config: `examples/evaluate/eb_alfred/config.yaml` | ||
|
|
||
| ## Training | ||
|
|
||
| ```bash | ||
| conda activate vagen | ||
|
|
||
| # Terminal 1 (env server): start service | ||
| python -m vagen.envs.eb_alfred.serve --devices='[0,1]' --capacity=90 | ||
|
|
||
| # Terminal 2 (training machine): run training | ||
| cd VAGEN | ||
| bash examples/train/eb_alfred/train_grpo_qwen25vl3b.sh | ||
| ``` | ||
|
|
||
| Configs: `examples/train/eb_alfred/` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag_idis not accepted byEnvSpechere either.The env-spec loader in
vagen/gym_agent_dataset.py:15-43instantiates each entry withEnvSpec(**OmegaConf.to_container(...)), and that dataclass does not definetag_id. Training will fail withTypeErrorbefore the dataset is even built unless this field is added to the schema or moved to a supported location.🤖 Prompt for AI Agents