[PR #2532] [CLOSED] feat(setup): add --engine-args to pass extra engine flags to the run config #4102

Closed
opened 2026-11-07 15:33:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2532
Author: @hlo-world
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: setup-engine-args


📝 Commits (2)

  • 467dc59 feat(setup): add --engine-args to pass extra engine flags to the run config
  • 4511882 fix(setup): address the --engine-args review - arity-aware merge, calibration re-apply, tests

📊 Changes

2 files changed (+151 additions, -6 deletions)

View changed files

📝 setup.py (+93 -5)
📝 tools/test_setup_qwen36.py (+58 -1)

📄 Description

Motivation

setup.sh already exposes some of the engine's flags as its own options (--context, --kv, --vram-reserve-mib, --parallel, ...), but the engine has far more levers than setup has options: the MTP verify depth (--spec) and the prefill chunk size (--prefill), for example, have no setup-side switch. A user who wants them has to hand-edit the generated run config - and a later setup run can rewrite that edit out from under them.

This PR adds one generic switch instead of one option per engine flag: --engine-args, a shell-quoted string of extra engine arguments appended to the model's engine arguments, in both install paths (own-path families and ready-made packs).

How it works

  • --engine-args takes a shell-quoted string, e.g. --engine-args '--prefill 1024 --spec 3'. Parsed with shlex, so quotes around individual values work.
  • Replace-not-duplicate: a same-named flag setup already wrote as a flag value pair is dropped before the extras are appended, so --engine-args --prefill 1024 overrides setup's --prefill instead of leaving two occurrences. The engine takes the last occurrence of a flag either way. A two-value flag (such as --control-vector-layer-range) is matched by its value count, so it is replaced whole.
  • The pre-v0.1.13 config migration (a --prefill 2048 becomes auto) skips a --prefill named in the extras: that value is the user's own, not a legacy default.
  • After a calibration runs, the saved extras are re-merged on top of it: calibration resets every flag in tools/calibrate.py DEFAULTS, and a user-chosen value would otherwise be moved or dropped.
  • Persistence: the raw string is saved in the run config as engine_args_extra (added to SETUP_KEYS), so re-running setup keeps the extras without re-passing them; passing the flag again overrides the saved value. --engine-args '' clears them.
  • Verification: unit tests for the merge (append, replace, two-value arity, boolean flags) and the calibration re-apply, plus an end-to-end --engine-args run through install_own_path in tools/test_setup_qwen36.py.

Usage

./setup.sh --setup --family qwen36 --model UD-Q4_K_XL --engine-args '--prefill 1024 --spec 3 --ple-io ram'

The generated run config's args ends with the extras, and a later ./setup.sh run for the same model keeps them.


Review response (second revision): the three reported issues are fixed - the test Namespace gains engine_args (plus end-to-end and unit coverage for the option), the merge matches same-named flags by their value count so a two-value flag is replaced whole instead of leaving a stray token, and the saved extras are re-merged right after each CAL.apply so a user-chosen value stays on top of the calibration. tools/test_setup_qwen36.py passes (21 tests), as does the rest of the setup/calibrate suites.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2532 **Author:** [@hlo-world](https://github.com/hlo-world) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `setup-engine-args` --- ### 📝 Commits (2) - [`467dc59`](https://github.com/Niko1221/Strata/commit/467dc5943398506481293f47207e03b801110d88) feat(setup): add --engine-args to pass extra engine flags to the run config - [`4511882`](https://github.com/Niko1221/Strata/commit/4511882304101635c91c599c19d3b74143b21b0c) fix(setup): address the --engine-args review - arity-aware merge, calibration re-apply, tests ### 📊 Changes **2 files changed** (+151 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+93 -5) 📝 `tools/test_setup_qwen36.py` (+58 -1) </details> ### 📄 Description ## Motivation setup.sh already exposes some of the engine's flags as its own options (--context, --kv, --vram-reserve-mib, --parallel, ...), but the engine has far more levers than setup has options: the MTP verify depth (--spec) and the prefill chunk size (--prefill), for example, have no setup-side switch. A user who wants them has to hand-edit the generated run config - and a later setup run can rewrite that edit out from under them. This PR adds one generic switch instead of one option per engine flag: `--engine-args`, a shell-quoted string of extra engine arguments appended to the model's engine arguments, in both install paths (own-path families and ready-made packs). ## How it works - `--engine-args` takes a shell-quoted string, e.g. `--engine-args '--prefill 1024 --spec 3'`. Parsed with shlex, so quotes around individual values work. - Replace-not-duplicate: a same-named flag setup already wrote as a flag value pair is dropped before the extras are appended, so `--engine-args --prefill 1024` overrides setup's `--prefill` instead of leaving two occurrences. The engine takes the last occurrence of a flag either way. A two-value flag (such as `--control-vector-layer-range`) is matched by its value count, so it is replaced whole. - The pre-v0.1.13 config migration (a `--prefill 2048` becomes `auto`) skips a `--prefill` named in the extras: that value is the user's own, not a legacy default. - After a calibration runs, the saved extras are re-merged on top of it: calibration resets every flag in tools/calibrate.py DEFAULTS, and a user-chosen value would otherwise be moved or dropped. - Persistence: the raw string is saved in the run config as `engine_args_extra` (added to SETUP_KEYS), so re-running setup keeps the extras without re-passing them; passing the flag again overrides the saved value. `--engine-args ''` clears them. - Verification: unit tests for the merge (append, replace, two-value arity, boolean flags) and the calibration re-apply, plus an end-to-end `--engine-args` run through `install_own_path` in tools/test_setup_qwen36.py. ## Usage ``` ./setup.sh --setup --family qwen36 --model UD-Q4_K_XL --engine-args '--prefill 1024 --spec 3 --ple-io ram' ``` The generated run config's `args` ends with the extras, and a later `./setup.sh` run for the same model keeps them. --- **Review response** (second revision): the three reported issues are fixed - the test Namespace gains `engine_args` (plus end-to-end and unit coverage for the option), the merge matches same-named flags by their value count so a two-value flag is replaced whole instead of leaving a stray token, and the saved extras are re-merged right after each `CAL.apply` so a user-chosen value stays on top of the calibration. tools/test_setup_qwen36.py passes (21 tests), as does the rest of the setup/calibrate suites. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:33:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4102
No description provided.