From 6cb4fe948aa5b0a16c35455bac30887dd84c2e9b Mon Sep 17 00:00:00 2001 From: Shannon Sands Date: Tue, 3 Feb 2026 16:24:47 +1000 Subject: [PATCH] group size 1 works, some timeouts but could be just local server --- .env.example | 4 +++ atropos/envs/swe_smith_oracle_env.py | 38 ++++++++++++++++++------ scripts/launch_llama_cpp_hermes_4_36b.sh | 7 +++++ 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index b289cddf3d..24ae87366f 100644 --- a/.env.example +++ b/.env.example @@ -28,6 +28,10 @@ HERMES_BACKEND=openai # ATROPOS_TOKENIZER_NAME=NousResearch/Hermes-4.3-36B # ATROPOS_SERVER_API_KEY=local # +# If you plan to run GRPO-style group sampling (e.g. `--env.group_size 4`) against +# llama.cpp, start the server with at least that many slots, e.g.: +# LLAMA_CPP_PARALLEL=4 Hermes-Agent/scripts/launch_llama_cpp_hermes_4_36b.sh +# # Generic OpenAI-compatible (base URL should include /v1): # OPENAI_BASE_URL=http://127.0.0.1:8080/v1 # OPENAI_API_KEY=local diff --git a/atropos/envs/swe_smith_oracle_env.py b/atropos/envs/swe_smith_oracle_env.py index ed773e77e4..b1603e1eb5 100644 --- a/atropos/envs/swe_smith_oracle_env.py +++ b/atropos/envs/swe_smith_oracle_env.py @@ -91,6 +91,11 @@ class SweSmithOracleEnv(AgentEnv[SweSmithOracleEnvConfig]): max_token_length=8192, inference_weight=1.0, wandb_name="swe_smith_oracle", + enabled_toolsets=["terminal"], + disabled_toolsets=[], + sandbox_image=os.getenv("ATROPOS_SANDBOX_IMAGE") or "atropos-sandbox:local", + purge_job_on_start=True, + purge_job_on_shutdown=True, ) server_configs = [ @@ -198,22 +203,37 @@ class SweSmithOracleEnv(AgentEnv[SweSmithOracleEnvConfig]): _ = trajectory_id repo = item.get("repo") base_commit = item.get("base_commit") + instance_id = item.get("instance_id") or item.get("id") or item.get("problem_id") if not isinstance(repo, str) or not isinstance(base_commit, str): raise RuntimeError("Invalid dataset row: missing repo/base_commit") repo_dir = self._repo_name(item) clone_url = f"{self.config.repo_base_url.rstrip('/')}/{repo}.git" - # Clone and checkout the base commit. - clone_cmd = f"rm -rf {repo_dir} && git clone {clone_url} {repo_dir}" - res = await exec_tool(ToolCall(name="terminal", arguments={"command": clone_cmd, "timeout": self.config.install_timeout_s})) + # Fetch only the requested base commit (much lighter than a full clone and robust + # even if the commit is not on the default branch ref we cloned). + # + # This also avoids some failure modes where `git clone` fetches only default-branch + # refs and then `git checkout ` fails because the commit isn't present locally. + clone_and_checkout_cmd = ( + f"rm -rf {repo_dir} && " + f"git init {repo_dir} && " + f"cd {repo_dir} && " + f"git remote add origin {clone_url} && " + f"git fetch --depth 1 origin {base_commit} && " + "git -c advice.detachedHead=false checkout -q FETCH_HEAD" + ) + res = await exec_tool( + ToolCall( + name="terminal", + arguments={"command": clone_and_checkout_cmd, "timeout": self.config.install_timeout_s}, + ) + ) if not res.success: - raise RuntimeError(f"git clone failed: {res.error}\n{res.output}") - - checkout_cmd = f"cd {repo_dir} && git checkout {base_commit}" - res = await exec_tool(ToolCall(name="terminal", arguments={"command": checkout_cmd, "timeout": self.config.install_timeout_s})) - if not res.success: - raise RuntimeError(f"git checkout failed: {res.error}\n{res.output}") + raise RuntimeError( + "git fetch/checkout failed " + f"(repo={repo}, base_commit={base_commit}, instance_id={instance_id}): {res.error}\n{res.output}" + ) # Best-effort baseline python env. setup_cmd = ( diff --git a/scripts/launch_llama_cpp_hermes_4_36b.sh b/scripts/launch_llama_cpp_hermes_4_36b.sh index 8e6f14be4e..c39fb5e13b 100755 --- a/scripts/launch_llama_cpp_hermes_4_36b.sh +++ b/scripts/launch_llama_cpp_hermes_4_36b.sh @@ -17,6 +17,7 @@ set -euo pipefail # LLAMA_CPP_HF_REPO=NousResearch/Hermes-4.3-36B-GGUF \ # LLAMA_CPP_HF_FILE=hermes-4_3_36b-Q4_K_M.gguf \ # LLAMA_CPP_ALIAS=hermes-4-36b \ +# LLAMA_CPP_PARALLEL=4 LLAMA_CPP_THREADS_HTTP=4 \ # Hermes-Agent/scripts/launch_llama_cpp_hermes_4_36b.sh HOST="${LLAMA_CPP_HOST:-127.0.0.1}" @@ -24,6 +25,8 @@ PORT="${LLAMA_CPP_PORT:-8080}" HF_REPO="${LLAMA_CPP_HF_REPO:-NousResearch/Hermes-4.3-36B-GGUF}" HF_FILE="${LLAMA_CPP_HF_FILE:-hermes-4_3_36b-Q4_K_M.gguf}" ALIAS="${LLAMA_CPP_ALIAS:-hermes-4-36b}" +PARALLEL="${LLAMA_CPP_PARALLEL:-4}" +THREADS_HTTP="${LLAMA_CPP_THREADS_HTTP:-4}" if ! command -v llama-server >/dev/null 2>&1; then echo "Error: llama-server not found in PATH." @@ -37,10 +40,12 @@ echo " port: $PORT" echo " repo: $HF_REPO" echo " file: $HF_FILE" echo " alias: $ALIAS" +echo " slots: $PARALLEL" echo echo "Suggested env vars for Hermes/Atropos integration:" echo " export ATROPOS_SERVER_BASE_URL=http://${HOST}:${PORT}" echo " export ATROPOS_SERVER_MODEL=${ALIAS}" +echo " export ATROPOS_TOKENIZER_NAME=NousResearch/Hermes-4.3-36B" echo " export ATROPOS_SERVER_API_KEY=local" echo @@ -59,5 +64,7 @@ exec llama-server \ --hf-repo "$HF_REPO" \ --hf-file "$HF_FILE" \ --alias "$ALIAS" \ + --parallel "$PARALLEL" \ + --threads-http "$THREADS_HTTP" \ -c 32768 \ -n -1