flock/sweep: the vLLM server turns thinking off for every request (the Qwen3.5 templates' defaults differ: the 27B's thinks, the 2B's doesn't); sweep.py puts each team on one server, the least loaded (until flock#129)
Browse files- flock/sweep/README.md +5 -3
- flock/sweep/serve-vllm.sbatch +4 -1
- flock/sweep/sweep.py +28 -5
flock/sweep/README.md
CHANGED
|
@@ -8,7 +8,7 @@ runs in the private `HuggingFaceSwarms/s3-aggregation-results`.
|
|
| 8 |
|
| 9 |
| File | |
|
| 10 |
| --- | --- |
|
| 11 |
-
| `serve-vllm.sbatch` | the model server: vLLM with `$MODEL` (default `Qwen/Qwen3.5-27B`) on one B200 GPU (Flock's docs/open-models.md) |
|
| 12 |
| `sweep.py` | runs the grid, one command, resumable: a row per team in `<root>/rows.jsonl` |
|
| 13 |
| `plot.py` | `scaling.png` (Figure 5's style), `teams.csv`, `by_n.csv` and `by_n.md` from the rows, one series per model |
|
| 14 |
| `setaside.py` | why each attempt in `rows-discarded.jsonl` didn't count, and how many teams needed a rerun |
|
|
@@ -42,8 +42,10 @@ workers small enough to be scheduled, except at N = 16, whose 2B teams need 16 C
|
|
| 42 |
run from a second driver (`--agents 16`) on the same root. Then plot both:
|
| 43 |
`plot.py --series Qwen3.5-27B=<root> --series Qwen3.5-2B=<root> --out <dir>`.
|
| 44 |
|
| 45 |
-
Each team is team.py's cluster spec (`--where cluster`) with the model on the servers
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
running the team in rootless podman with a local board, sized to the team (a CPU per agent, at
|
| 48 |
least 4). The board rules, loop and limits are the template's at every N. sweep.py inits and
|
| 49 |
launches a team, waits until its loop is done and its agents are idle, releases it
|
|
|
|
| 8 |
|
| 9 |
| File | |
|
| 10 |
| --- | --- |
|
| 11 |
+
| `serve-vllm.sbatch` | the model server: vLLM with `$MODEL` (default `Qwen/Qwen3.5-27B`) on one B200 GPU (Flock's docs/open-models.md), thinking off for every request (the Qwen3.5 templates' defaults differ: the 27B's thinks, the 2B's doesn't) |
|
| 12 |
| `sweep.py` | runs the grid, one command, resumable: a row per team in `<root>/rows.jsonl` |
|
| 13 |
| `plot.py` | `scaling.png` (Figure 5's style), `teams.csv`, `by_n.csv` and `by_n.md` from the rows, one series per model |
|
| 14 |
| `setaside.py` | why each attempt in `rows-discarded.jsonl` didn't count, and how many teams needed a rerun |
|
|
|
|
| 42 |
run from a second driver (`--agents 16`) on the same root. Then plot both:
|
| 43 |
`plot.py --series Qwen3.5-27B=<root> --series Qwen3.5-2B=<root> --out <dir>`.
|
| 44 |
|
| 45 |
+
Each team is team.py's cluster spec (`--where cluster`) with the model on one of the servers,
|
| 46 |
+
the one with the fewest agents of running teams (until flock#129, agents pick a server by name
|
| 47 |
+
alone, so with every server in each spec, every concurrent team's `agent-001` would land on one
|
| 48 |
+
server: flock#127): `compute: slurm`, one worker on hopper-cpu
|
| 49 |
running the team in rootless podman with a local board, sized to the team (a CPU per agent, at
|
| 50 |
least 4). The board rules, loop and limits are the template's at every N. sweep.py inits and
|
| 51 |
launches a team, waits until its loop is done and its agents are idle, releases it
|
flock/sweep/serve-vllm.sbatch
CHANGED
|
@@ -14,10 +14,13 @@ PORT=${PORT:-8000}
|
|
| 14 |
IMAGE=${IMAGE:-/fsx/anton/shared/images/vllm-openai-v0.32.0.sqsh}
|
| 15 |
export HF_HOME=/hf
|
| 16 |
mkdir -p "/scratch/$USER/hf" # the weights, on the node's own disk
|
|
|
|
|
|
|
| 17 |
srun --overlap --container-image="$IMAGE" --no-container-mount-home \
|
| 18 |
--container-mounts="/scratch/$USER/hf:/hf" --container-env=HF_HOME \
|
| 19 |
vllm serve "$MODEL" --port "$PORT" \
|
| 20 |
-
--enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3
|
|
|
|
| 21 |
until curl -sf -o /dev/null "localhost:$PORT/v1/models"; do
|
| 22 |
sleep 10
|
| 23 |
kill -0 $! 2>/dev/null || { echo "vLLM exited during startup"; exit 1; }
|
|
|
|
| 14 |
IMAGE=${IMAGE:-/fsx/anton/shared/images/vllm-openai-v0.32.0.sqsh}
|
| 15 |
export HF_HOME=/hf
|
| 16 |
mkdir -p "/scratch/$USER/hf" # the weights, on the node's own disk
|
| 17 |
+
# Thinking off for every request: s3 runs compare models without thinking, and the Qwen3.5 chat
|
| 18 |
+
# templates' defaults differ (the 27B's thinks, the 2B's doesn't), so the server sets it.
|
| 19 |
srun --overlap --container-image="$IMAGE" --no-container-mount-home \
|
| 20 |
--container-mounts="/scratch/$USER/hf:/hf" --container-env=HF_HOME \
|
| 21 |
vllm serve "$MODEL" --port "$PORT" \
|
| 22 |
+
--enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3 \
|
| 23 |
+
--default-chat-template-kwargs '{"enable_thinking": false}' &
|
| 24 |
until curl -sf -o /dev/null "localhost:$PORT/v1/models"; do
|
| 25 |
sleep 10
|
| 26 |
kill -0 $! 2>/dev/null || { echo "vLLM exited during startup"; exit 1; }
|
flock/sweep/sweep.py
CHANGED
|
@@ -6,8 +6,9 @@ Flock's checkout (its environment, and its `.venv` for the workers):
|
|
| 6 |
[--bucket lewtun/s3-aggregation-sweep] [--dataset HuggingFaceSwarms/s3-aggregation-results]
|
| 7 |
|
| 8 |
Each (problem, N) team is its own flock run (`compute: slurm`, podman agents on hopper-cpu, a
|
| 9 |
-
local board on its one worker), from team.py's cluster spec with the sweep's model on
|
| 10 |
-
|
|
|
|
| 11 |
N), `flock launch`, wait until its loop is done and its agents are idle, `flock stop --release`
|
| 12 |
(each Trial is graded as the worker drains; the results land in the run directory), then
|
| 13 |
eval/metrics.py's row plus the wall time goes to `<root>/rows.jsonl`. Until flock#121
|
|
@@ -44,6 +45,8 @@ REPO = Path.cwd() # Flock's checkout
|
|
| 44 |
MODEL = "Qwen/Qwen3.5-27B"
|
| 45 |
SECRET = re.compile(r"hf_[A-Za-z0-9]{30,}")
|
| 46 |
lock, init_lock = threading.Lock(), threading.Semaphore(4)
|
|
|
|
|
|
|
| 47 |
LOST, GONE = "controller lost", "no controller left"
|
| 48 |
# the loop's `until` (and the driver's team timeout) count from the launch, not from the worker's
|
| 49 |
# start: a run whose worker queued longer than this (a busy or scaling partition) doesn't count
|
|
@@ -138,7 +141,27 @@ def wait_done(run_dir: Path, task: str, n: int, timeout: float) -> str:
|
|
| 138 |
|
| 139 |
|
| 140 |
def attempt(args, root: Path, secrets: Path, problem: int, n: int, name: str) -> dict | None:
|
| 141 |
-
"""One run of a team as swarm `name`: its row, or None when it could not
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
run_dir, src = root / "runs" / name, root / "src" / name
|
| 143 |
if run_dir.exists() and (any((run_dir / "launch").glob("*.env"))
|
| 144 |
or (run_dir / "hosts" / "controller.host").exists()):
|
|
@@ -152,7 +175,7 @@ def attempt(args, root: Path, secrets: Path, problem: int, n: int, name: str) ->
|
|
| 152 |
if run_dir.exists():
|
| 153 |
shutil.rmtree(run_dir) # init failed before: nothing ran
|
| 154 |
started = time.time()
|
| 155 |
-
write_experiment(src, problem, n, name,
|
| 156 |
log = root / "logs" / f"{name}-init.log"
|
| 157 |
log.parent.mkdir(parents=True, exist_ok=True)
|
| 158 |
for tries in range(3):
|
|
@@ -167,7 +190,7 @@ def attempt(args, root: Path, secrets: Path, problem: int, n: int, name: str) ->
|
|
| 167 |
failed = [x for x in init.stdout.splitlines() if x.startswith("FAIL")]
|
| 168 |
say(name, "init failed 3 times:", failed or init.stdout[-300:], "(log:", log, ")")
|
| 169 |
return None
|
| 170 |
-
say(name, "launching")
|
| 171 |
launch = flock(run_dir, "launch", str(run_dir / "experiment"))
|
| 172 |
if launch.returncode != 0:
|
| 173 |
say(name, "launch failed:", launch.stdout[-600:], launch.stderr[-600:])
|
|
|
|
| 6 |
[--bucket lewtun/s3-aggregation-sweep] [--dataset HuggingFaceSwarms/s3-aggregation-results]
|
| 7 |
|
| 8 |
Each (problem, N) team is its own flock run (`compute: slurm`, podman agents on hopper-cpu, a
|
| 9 |
+
local board on its one worker), from team.py's cluster spec with the sweep's model on one of
|
| 10 |
+
`urls`, the server with the fewest agents of running teams (the same board rules, loop and
|
| 11 |
+
limits at every N). Per team: `flock init` (a worker sized to
|
| 12 |
N), `flock launch`, wait until its loop is done and its agents are idle, `flock stop --release`
|
| 13 |
(each Trial is graded as the worker drains; the results land in the run directory), then
|
| 14 |
eval/metrics.py's row plus the wall time goes to `<root>/rows.jsonl`. Until flock#121
|
|
|
|
| 45 |
MODEL = "Qwen/Qwen3.5-27B"
|
| 46 |
SECRET = re.compile(r"hf_[A-Za-z0-9]{30,}")
|
| 47 |
lock, init_lock = threading.Lock(), threading.Semaphore(4)
|
| 48 |
+
servers_lock = threading.Lock()
|
| 49 |
+
server_load: dict[str, int] = {} # server -> agents of the teams running on it
|
| 50 |
LOST, GONE = "controller lost", "no controller left"
|
| 51 |
# the loop's `until` (and the driver's team timeout) count from the launch, not from the worker's
|
| 52 |
# start: a run whose worker queued longer than this (a busy or scaling partition) doesn't count
|
|
|
|
| 141 |
|
| 142 |
|
| 143 |
def attempt(args, root: Path, secrets: Path, problem: int, n: int, name: str) -> dict | None:
|
| 144 |
+
"""One run of a team as swarm `name` on one server: its row, or None when it could not
|
| 145 |
+
start. The team gets the server with the fewest agents of running teams (an adopted team
|
| 146 |
+
keeps its own): until flock#129, agents pick a server by name alone, so with every server in
|
| 147 |
+
each spec, every concurrent team's agent-001 would land on one server (flock#127)."""
|
| 148 |
+
spec = root / "runs" / name / "experiment" / "spec.yaml"
|
| 149 |
+
kept = None
|
| 150 |
+
if spec.exists():
|
| 151 |
+
kept = (yaml.safe_load(spec.read_text()).get("inference") or {}).get("urls")
|
| 152 |
+
with servers_lock:
|
| 153 |
+
server = kept[0] if kept and len(kept) == 1 else min(
|
| 154 |
+
args.urls, key=lambda url: (server_load.get(url, 0), args.urls.index(url)))
|
| 155 |
+
server_load[server] = server_load.get(server, 0) + n
|
| 156 |
+
try:
|
| 157 |
+
return run_attempt(args, root, secrets, problem, n, name, server)
|
| 158 |
+
finally:
|
| 159 |
+
with servers_lock:
|
| 160 |
+
server_load[server] -= n
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def run_attempt(args, root: Path, secrets: Path, problem: int, n: int, name: str,
|
| 164 |
+
server: str) -> dict | None:
|
| 165 |
run_dir, src = root / "runs" / name, root / "src" / name
|
| 166 |
if run_dir.exists() and (any((run_dir / "launch").glob("*.env"))
|
| 167 |
or (run_dir / "hosts" / "controller.host").exists()):
|
|
|
|
| 175 |
if run_dir.exists():
|
| 176 |
shutil.rmtree(run_dir) # init failed before: nothing ran
|
| 177 |
started = time.time()
|
| 178 |
+
write_experiment(src, problem, n, name, [server], args.model, args.revision)
|
| 179 |
log = root / "logs" / f"{name}-init.log"
|
| 180 |
log.parent.mkdir(parents=True, exist_ok=True)
|
| 181 |
for tries in range(3):
|
|
|
|
| 190 |
failed = [x for x in init.stdout.splitlines() if x.startswith("FAIL")]
|
| 191 |
say(name, "init failed 3 times:", failed or init.stdout[-300:], "(log:", log, ")")
|
| 192 |
return None
|
| 193 |
+
say(name, "launching on", server)
|
| 194 |
launch = flock(run_dir, "launch", str(run_dir / "experiment"))
|
| 195 |
if launch.returncode != 0:
|
| 196 |
say(name, "launch failed:", launch.stdout[-600:], launch.stderr[-600:])
|