Skip to content

[server] Passing model_override_args to launch_server via the CLI. - #1298

Merged
merrymercy merged 4 commits into
sgl-project:mainfrom
kevin85421:model_override_args
Sep 9, 2024
Merged

merrymercy merged 4 commits into
sgl-project:mainfrom
kevin85421:model_override_args

Conversation

@kevin85421

@kevin85421 kevin85421 commented Sep 2, 2024 •

Copy link
Copy Markdown
Collaborator

Motivation

  1. Passing model_override_args to launch_server via the CLI.
  2. Add a new function prepare_server_args to make the logic more unit testable.

Closes #591

Modifications

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

Signed-off-by: Kai-Hsun Chen <[email protected]>
Prepare the server arguments from the command line arguments.

Args:
args: The command line arguments. Typically, it should be `sys.argv[1:]`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Kai-Hsun Chen <[email protected]>
@@ -0,0 +1,24 @@
import unittest

@kevin85421 kevin85421 Sep 2, 2024 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was marked as resolved.

@merrymercy merrymercy Sep 3, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevin85421 Add it here

suites = {
"minimal": [
"models/test_embedding_models.py",
"models/test_generation_models.py",
"sampling/penaltylib",
"test_chunked_prefill.py",

This "minimal" suite will be run on CI

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Added 3ecf574.

"-m",
"sglang.bench_latency",
"--model",
"--model-path",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--model could be --model-path or --model-override-args.

This comment was marked as resolved.

@merrymercy merrymercy Sep 3, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename --model-override-args to --override-model-args?

In the meanwhile, we can change all --model in the code base to --model-path to avoid future ambiguity

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename --model-override-args to --override-model-args?

How about --json-model-override-args, or do you prefer --override-model-args?

In the meanwhile, we can change all --model in the code base to --model-path to avoid future ambiguity

image

@merrymercy

Copy link
Copy Markdown
Collaborator

Let me know when it is ready for review.

@merrymercy
merrymercy marked this pull request as ready for review September 4, 2024 11:00
@kevin85421 kevin85421 changed the title [WIP][server] Passing model_override_args to launch_server via the CLI. [server] Passing model_override_args to launch_server via the CLI. Sep 4, 2024
@kevin85421

Copy link
Copy Markdown
Collaborator Author

@merrymercy I have already removed "WIP" from the PR title. It's ready for another review iteration. Thanks!

@merrymercy
merrymercy merged commit c9b7591 into sgl-project:main Sep 9, 2024
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 9, 2026
…e: F3 made executable, the gap pinned

PART (C) IS NOT BUILT, AND THIS COMMIT SAYS WHY AT file:line INSTEAD OF
GUESSING. The briefing's premise -- "hang the deferral mark on the
group-agreed truncation outcome, the A12.2 path already exists" -- does not
survive reading the two ends of that path.

BLOCKER 1, the truncation never reaches the deferral. A read the pool CUT
still REGISTERS (unified_radix_cache.py:3614 non-symmetric, :3833 the sgl-project#1290
group trim), so `_prefetch_kvcache`'s effect-based verdict is `issued`,
byte-identical to a read that landed whole. `_apply_prefetch_deferral`
(scheduler.py:5990) is entered ONLY by `declined:rate_limited`. Measured on
the sb5h D log: `host_pool_truncated=37` per rank with no `rate_limited`, no
`deferred`, no `defer_refused` key present in the sgl-project#915 census at all.

BLOCKER 2, and it is the one that matters. Even a verdict that DID reach the
machine leaves no mark on group D: `_prefetch_deferral_refusal_reason()`
(scheduler.py:5932) returns `symmetric_vote` whenever the tree votes, and
group D votes -- 660 genuine `reason=vote_negative` lines on the sb5h D log,
a branch that exists only inside `if symmetric:`. The refusal's own stated
reason (scheduler.py:570-574) is the exact hazard the briefing forbids
creating: "a rank-divergent deferred set would enter that vote unevenly."

WHY "IT IS ONLY A VOTE, THE MIN REDUCE MAKES IT UNIFORM" DOES NOT RESCUE IT.
That argument holds for the X gate, which consumes
`_weg2_store_read_is_pending` through a MIN reduce and says so. It does not
hold for the OTHER consumer: `_retry_deferred_prefetches` (scheduler.py:6208)
re-enters `prefetch_from_storage` and therefore the sgl-project#580 participation
all_reduce (unified_radix_cache.py:3780). A mark set on a rank-local term
makes the RETRY SET rank-local and the ranks enter different collectives --
a desync crash, not a mispricing.

AND THE TERM IS RANK-LOCAL BY CONSTRUCTION. `group_len` is group-agreed (MIN
reduce plus the desync raise at :3796). The trim CONDITION is `group_len <
len(prefetch_key)`, and that second half derives from `_matched_len =
len(req.prefix_indices) + req.host_hit_length` (scheduler.py:5137),
documented rank-local at :5115-5117. Measured rank-unanimous 37/37 on sb5h --
empirically uniform, NOT uniform by construction, which is the standard the
briefing set.

WHAT SHIPS

* F3 RUNS NOW. Fix 2 wrote the acceptance and it was never executed as a
  pytest node (skipped remotely, no local pytest under a boot window), so its
  34/37 had only ever been computed by hand. The lines it reads are cut into
  fixtures/sb5h_D_truncation_terminals_1298.log (129 lines from 109,471) and
  the test reads the fixture everywhere. `test_f3_fixture_is_faithful`
  re-runs the identical walk over the full 23 MB log wherever the evidence
  tree exists and asserts both the truncated set AND the orphan set match, so
  the cut cannot drift into a friendlier subject. It also now filters
  `over_bound=true` as the acceptance specifies (111/111 on sb5h -- the
  filter removes nothing, and the denominator is stated rather than assumed)
  and asserts a population floor so a green cannot come from an empty walk.

* THE GAP IS PINNED WHERE THE HARNESS ALREADY LIVES
  (test_prefetch_deferral_1068.py, characterisation and labelled as such --
  these pass on the parent): an `issued` verdict is not the deferral's
  business, and the rate verdict is the only door in, enumerated over every
  other verdict `_prefetch_kvcache` can return. A future part (C) must add
  its door there, and this is what will notice. Blocker 2 is NOT duplicated
  -- `TestTheMarkDoesNotSurviveTheCutover` already pins it.

No new W-code (the census in test_weg2_wcode_uniqueness_1263.py is untouched
and none was needed). No source file changed: the fix shape is named in the
record, not half-built.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 9, 2026
…ect#1290 MIN payload, so a group-cut read defers instead of being priced whole

S1 the span rides the vote (unified_radix_cache.py): slots 3/4 carry this
rank's pre-vote span and its negation, so one MIN yields both ends. The
truncation condition group_len < span is then computed from two REDUCED
values and is identical on every rank. A span split is W55
Weg2PrefetchSpanSplit, a named STOP in the same class as the two raises
above it, placed BELOW the threshold return because an ineligible rank
enters the vote carrying an empty span.

Why a span and not a shortfall bit: group_len is a MIN, so ONE short rank
cuts every rank's registered span. The group fact is the OR, which
group_len < span already computes; MIN over a raw bit is the AND, i.e.
inverted, and redundant besides.

S2 published on the census the scheduler already samples per call, under a
key only the post-consensus group trim bumps -- the non-symmetric site's cut
is rank-local and must not reach the deferral.

S3 verdict issued:truncated_group (not a decline: the read registered).
X-DEFER now names its reason so a shortfall defer is never read as
rate_limited.

S4 the symmetric_vote refusal is SCOPED, not deleted: its own text says it is
about a rank-local mark entering the sgl-project#580 vote unevenly, which cannot
describe a mark built from MIN-reduced values. rate_limited keeps every
refusal it had; unpriced_timeout and symmetric_probe_failed still refuse
both. The retry evaluates the refusal per mark reason, so the retry set is
rank-identical by construction.

S5 every exit already existed: carrier-exceeds is the undeferrable exit
(its limit IS the carrier bound, 27466 on the boot's own sgl-project#915 line) taken on
the FIRST mark so it cannot loop; the repeat case re-defers under
_deferred_prefetch_bound_s and leaves by DEFER EXPIRED.

Ruff added 0 (the 2 findings are pre-existing at HEAD, same lines).
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 9, 2026
… named and fixed

Both found by RUNNING, not by reading, and both are the curated-stand-in class
fix 1 of this branch already paid for once (_store_grid_floor as a method took
6 tests red across three harnesses that bind a curated list of real methods
onto a SimpleNamespace).

1. test_prefetch_participation_desync_580 TestForeignPayloadIsLoud built its
   foreign vector 3 wide. Its whole subject is traffic gloo CANNOT reject on
   SIZE, so the fixture must track the payload width; it now slices the real
   width. The property it pins is unchanged.

2. test_prefetch_deferral_1068 _Intake binds scheduler methods by NAME, so the
   new _apply_group_shortfall_deferral was simply absent. Bound.

No source change in this commit.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 9, 2026
…erisation, the acceptance takes the next boot's log

The fixture is a recording of a boot that ran WITHOUT the fix, so no code
change on this branch can turn it green. A test that can only ever be red is
not an acceptance, it is a permanent red people learn to scroll past.

* test_f3_the_walk_reproduces_the_recorded_defect_exactly pins the pre-fix
  number in executable form (37 truncated, 34 orphans) and proves the walk.
* test_f3_invariant_holds_on_a_post_fix_log runs the SAME walk against
  WEG2_F3_LOG -- gate 4 of the boot ticket, the only place the invariant can
  honestly go green. Skips without the variable rather than passing on an
  empty walk, and keeps the population floor.

Also: the landed assertion in the new shortfall arm matched _assert_unmarked,
which is the FULL clearer's contract. sgl-project#1068's landed path clears the mark and
arms the one-pass hold, leaving the timing fields as history. Asserted as
sgl-project#1068 actually specifies it.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 9, 2026
…s arm makes reachable for the first time

_admission_held_for_deferred_prefetch records an OPEN hazard: in the TP phase
the PP0 exemption is inert, so every rank holds on its own mark, and sgl-project#1068's
mark is rank-local at both ends. On group D that path was previously
unreachable -- no mark could exist there (symmetric_vote). This arm makes it
reachable, so the precondition is checked rather than inherited: the shortfall
mark comes from MIN-reduced values, so all three ranks hold and release
together. Asserted both directions.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 10, 2026
…acts the fix legitimately moved

The first gate run of this branch read 76 failures against the base's 49 --
27 NEW, every one of them in the prefetch/vote/store families the edits touch.
Three distinct causes, and only one of them was a defect in the fix:

1. THE CURATED-STAND-IN TRAP (sgl-project#1298's own lesson, paid a second time). Five
   harnesses bind `prefetch_from_storage` / the X-gate methods onto a
   `types.SimpleNamespace`, so `self._weg2_window_alloc_cap()` and
   `self._weg2_windowed_store_read_active()` raised AttributeError there --
   23 of the 27. Both are now asked through `getattr(..., None)` + `callable`,
   the same shape `draft_tier_armed_for` already uses, so a stand-in that does
   not carry them gets the pre-#1317k arithmetic, which is exactly what those
   harnesses assert. The methods' existence on the real class is pinned by
   test_weg2_window_liveness_1317k, so this cannot silently disable the cap in
   the tree that matters. ONE call site each, rather than curating five
   harnesses that will be curated again by the next method.

2. THE LIFECYCLE TABLE WAS RIGHT TO FAIL. `_weg2_window_open` gained a third
   writer -- the terminal exit disarms the mark because the request has just
   been answered W88/W89 and removed from the queue -- and
   test_weg2_store_priced_x_1317's AST assertion counts writers against the
   table in `_weg2_issue_next_window`'s docstring. It caught the third writer
   the moment it appeared, which is precisely what it exists for. The table
   now names it and the count is 3.

3. A SOURCE-LINE ASSERTION PINNED A LINE BREAK. test_weg2_1246_carrier_census
   asserted the single-line spelling of the post-leg-1 guard, which now spans
   two lines because it gained `and not self.windowed_carrier`. Re-asserted on
   the TERMS (both halves, separately) rather than on one line's formatting --
   the help-text sentence it guards is about the terms, and pinning the layout
   made it fail on a change that did not touch its subject.

Local re-run of all six affected files plus the new one: 152 passed, 1
skipped. Hermetic (CUDA_VISIBLE_DEVICES=""), which four of them require to
collect at all.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 10, 2026
…ed read, and the anchor ask was never capped

Boot weg2sn6n confirmed #1317k's root and fix on metal -- `W=4096` wired, 39x
`got=4096` with `available=26422`, `available=0` on **0 of 138** `sgl-project#915` lines,
`reason=vote_negative` down from 26,985 to **90**, `closed_total` off zero for
the first time -- and then failed on four things that the same boot named.

(1) A DECLINE IS NOT A FINISHED READ. `still_owed = verdict ==
"issued:truncated_group"` closed the chain on `declined:anchor_pool_exhausted`
after window 1 of ~27, so the request was priced at the 4,096 tokens it
happened to hold out of 109,130 and there was never a window 2 for C1 to
release for. Three outcomes where there were two: a truncated group still owes
one; ANY `declined:*` leaves the window OWED (nothing landed and nothing was
decided -- a busy anchor pool is not a statement about the prompt); only a
whole `issued` closes the chain. Safe ONLY because the standstill exit exists:
a decline that recurs while nothing moves reaches
`_weg2_prefetch_stall_passes()` and is answered W88 by name, so the progress
witness is this change's precondition rather than an addition to it.

(2) THE ANCHOR ASK WAS NEVER CAPPED -- #1317k capped one of two pools. The KV
alloc is bounded, but the component loop still asked every component for
`len(prefetch_key)`, the WHOLE remaining prompt, because prefetch_key is
trimmed only AFTER the group vote. So a 109,128-token remainder asked the mamba
component for ~27 anchors against a 13-slot pool
(`host_anchor_avail=0 host_anchor_size=13` on 93 lines,
`anchor_pool_exhausted=19/29`) while the KV pool sat at `available=26422` --
two pools, one of them asked for 26x what the read could hold. Now built for
`len(host_indices)`, the span actually allocated: 2 anchors per window against
13 slots. PRE-EXISTING and only made binding by #1317k, which is the honest
framing -- before the cap the KV span was the whole pool and the component ask
was still 109,128.

(3) THE CENSUS GAP THE BOOT NAMED. #1317k promised "a bare WINDOW-RELEASE=0 is
now impossible" and it held only for a chain that DIES: the sn6n chain CLOSED,
took the success path, and printed no census anywhere. The vector now rides
EVERY re-issue line, close included, through one accessor that names its own
absence (`unnamed:no_census_on_this_tree`) rather than returning blank -- a
missing census and an all-zero census read the same to a grep.

(4) THE EXEMPTION DIED ON ITS OWN TERMS. `exempt_carrier_exceeds` fired 15x on
sn6n and prefilled the whole 109k prompt on D over X=11,101 **while the client
was refused anyway** -- worst of both, and the barrier that used to feed it was
already gone (`CARRIER-EXCEEDS after leg 1` = 0). Its own comment set the
sunset: "the exemption dies in the same commit as the wall, when the carrier
build gives this group an unbounded windowed store read." This is that commit.
Retired on the windowed path only; over-X now takes the ordinary named
W31/W50 exit, which `is_x_refusal` matches, so the front re-routes once (W35
bounds the second), while W88/W89 deliberately do NOT match and reach the
client.

THE GUARD IS A MODULE FUNCTION, THIRD FORM AND THE FIRST THAT WORKS. Direct
`self._weg2_windowed_store_read_active()` raised on five SimpleNamespace
harnesses (one gate run). A defensive METHOD failed identically, one level out,
because those harnesses bind a CURATED list of real methods and a NEW method is
missing from them exactly as the predicate was (a second gate run). A module
function resolves in globals, never on the receiver, so no stand-in can be
missing it -- immune by construction instead of by curation, which is what
sgl-project#1298's lesson actually demands.

Tests: 27 in test_weg2_window_liveness_1317k (both directions of (1): a decline
keeps the window owed AND only a whole read closes it AND the standstill exit
stays inside the owed arm), the anchor arithmetic (2 needed vs 13 held vs the
~27 that fired), the census's named absence, and the exemption's gating.
229 passed / 1 skipped across all twelve affected files, hermetic.
Confirming gate of the previous SHA came back GREEN at bab0c0f: 6349/49
against base 6334/49, NEW=0.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 10, 2026
Written, NOT YET RUN: XSN7 holds the box (booking m64bnw, 3 compute apps), so
per the standing rule nothing executed here. The file is the pin the operator
required before sgl-project#1330 may be pushed, and it is hermetic by construction -- no
CUDA, no device, no allocator, because the guard returns BEFORE
`torch.cuda.stream(...)` is touched. That is also why the probe reads
`untyped_storage().data_ptr()` rather than making a CUDA call: a probe that can
itself fault is no probe.

SIX PINS, and the two mutants the operator named are the load-bearing pair:
* `test_no_copy_is_attempted_when_the_backing_is_gone` -- M1. The stand-in's
  `copy_` RAISES if it is ever reached, and the control word counts its own
  slices, so removing the probe makes this red with the boot log's own message
  rather than with a changed number.
* `test_the_disarm_is_latched_and_the_line_appears_exactly_once` -- M2. Ten
  rounds must produce ONE line and ZERO copies. An unlatched disarm re-logs
  every round and, worse, leaves `_abort_poll_active` True so the copy is
  retried -- which is the amplifier this whole fix removes.
* the last-verdict pin: disarm costs the LAST KNOWN verdict and nothing more
  (the word only goes 0 -> non-zero once), including the already-tripped case.
* `test_the_healthy_path_is_untouched_by_the_probe` -- the negative control. A
  live storage must fall THROUGH to the staging copy, proven by the copy being
  ATTEMPTED. If that ever stops raising, the guard has begun swallowing healthy
  polls, which no other assertion here would catch.
* the two pre-existing early exits keep their behaviour, and an
  already-inactive poll is explicitly NOT a disarm event (it must not log one).
* the gate's belt, as a source pin, including `callable(_disarm)` -- the sgl-project#1298
  curated-stand-in trap, which this campaign has now paid for twice.

Corrected while writing it: the class that owns `poll_status_word` is
`BarlinkBar1Transport`, not `Bar1Transport`. The first cut bound the methods off
a name that does not exist, which would have made every case red for the wrong
reason -- an instrument that cannot go green is as useless as one that cannot
go red.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

model_override_args with server

3 participants