Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions tunix/experimental/examples/deepswe_dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ distributed GSM8K example:
because it is already a generic PeftTrainer V2 worker.

The first milestone is intentionally small: run one trainer+rollout pipeline
step with `BETA=0.0` and `WEIGHT_SYNC_MODE=none`. Reference KL, Raiden weight
sync, agent-sandbox prewarming, and production DeepSWE-scale settings can be
layered on after the basic pipeline is stable.
step with `BETA=0.0` and `WEIGHT_SYNC_MODE=none`. The default path uses the
regular DeepSWE `SWEEnv` backend. Set `USE_AGENT_SANDBOX=1` to construct
`SWEEnv` with `SandboxFleet` inside the rollout worker process.

```bash
cd tunix/experimental/examples/deepswe_dist
BETA=0.0 WEIGHT_SYNC_MODE=none MAX_STEPS=1 BATCH_SIZE=1 NUM_GENERATIONS=2 ./launcher.sh
```
```

```bash
cd tunix/experimental/examples/deepswe_dist
USE_AGENT_SANDBOX=1 BETA=0.0 WEIGHT_SYNC_MODE=none MAX_STEPS=1 BATCH_SIZE=1 NUM_GENERATIONS=2 ./launcher.sh
```

For sandbox placement, set `SANDBOX_NAMESPACE`, `SANDBOX_NODE_SELECTOR_KEY`, and
`SANDBOX_NODE_SELECTOR_VAL` before launching. The launcher forwards them to the
rollout worker as the `agent_sandbox_rl` variables consumed by `SWEEnv`.
10 changes: 10 additions & 0 deletions tunix/experimental/examples/deepswe_dist/deepswe.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ def __init__(
group_id = prompt_id or None
if pair_index is None:
pair_index = group_index
if kwargs.get("use_agent_sandbox") and kwargs.get("fleet") is None:
logging.info(
"Initializing DeepSWE SandboxFleet in rollout worker "
"(max_concurrency=%s).",
group_size,
)
kwargs["fleet"] = swe_env._init_global_fleet( # pylint: disable=protected-access
tasks=[entry],
max_concurrency=group_size,
)

super().__init__(
entry=entry,
Expand Down
10 changes: 10 additions & 0 deletions tunix/experimental/examples/deepswe_dist/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ SEED=${SEED:-42}
ENV_BACKEND=${ENV_BACKEND:-kubernetes}
SCAFFOLD=${SCAFFOLD:-r2egym}
USE_AGENT_SANDBOX=${USE_AGENT_SANDBOX:-0}
SANDBOX_NAMESPACE=${SANDBOX_NAMESPACE:-rl-tunix-swebench}
SANDBOX_NODE_SELECTOR_KEY=${SANDBOX_NODE_SELECTOR_KEY:-}
SANDBOX_NODE_SELECTOR_VAL=${SANDBOX_NODE_SELECTOR_VAL:-}
STEP_TIMEOUT_SECS=${STEP_TIMEOUT_SECS:-1800}
REWARD_TIMEOUT_SECS=${REWARD_TIMEOUT_SECS:-1800}
ROLLOUT_MAX_CONCURRENCY=${ROLLOUT_MAX_CONCURRENCY:-64}
Expand Down Expand Up @@ -290,6 +293,13 @@ echo "Launching DeepSWE rollout node..."
export TPU_CHIPS_PER_HOST_BOUNDS=${TPU_CHIPS_PER_HOST_BOUNDS}
export TPU_HOST_BOUNDS=${TPU_HOST_BOUNDS}
export LIBTPU_INIT_ARGS="--deepsea_chips_per_host_bounds=${TPU_CHIPS_PER_HOST_BOUNDS} --deepsea_host_bounds=${TPU_HOST_BOUNDS}"
if [[ "$USE_AGENT_SANDBOX" == "1" || "$USE_AGENT_SANDBOX" == "true" || "$USE_AGENT_SANDBOX" == "True" ]]; then
export NAMESPACE="$SANDBOX_NAMESPACE"
if [[ -n "$SANDBOX_NODE_SELECTOR_KEY" && -n "$SANDBOX_NODE_SELECTOR_VAL" ]]; then
export NODE_SELECTOR_KEY="$SANDBOX_NODE_SELECTOR_KEY"
export NODE_SELECTOR_VAL="$SANDBOX_NODE_SELECTOR_VAL"
fi
fi
export PYTHONUNBUFFERED=1
print_command "Rollout command" "${ROLLOUT_CMD[@]}"
exec "${ROLLOUT_CMD[@]}" > "$ROLLOUT_LOG" 2>&1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,4 @@ def main(argv: list[str], context: ProcessContext | None = None) -> None:


if __name__ == "__main__":
main(sys.argv[1:])
main(sys.argv[1:])
Loading