Skip to content

import outlines - #168

Merged
hnyls2002 merged 1 commit into
mainfrom
outlines-integration
Feb 9, 2024
Merged

hnyls2002 merged 1 commit into
mainfrom
outlines-integration

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Feb 8, 2024 •

Copy link
Copy Markdown
Collaborator

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.

@hnyls2002
hnyls2002 merged commit 37b4229 into main Feb 9, 2024
@hnyls2002
hnyls2002 deleted the outlines-integration branch February 9, 2024 02:13
isidentical added a commit to isidentical/sglang that referenced this pull request Feb 16, 2024
@isidentical

Copy link
Copy Markdown

Looks like this PR broke compatibility with pydantic<2 which still has many users (Because of transitive dependencies) :/ I'll try to maintain a fork without it, but I'd love if there was at least some sort of a grace period for it where both revisions maybe maintained.

timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
amote-i pushed a commit to amote-i/sglang that referenced this pull request Dec 8, 2025
* fix dbrx logic

(cherry picked from commit 0351f5a9eac867922d97860a53a8b52e0fe67683)

* combine differe npu fused

* cleancode

(cherry picked from commit 38d59a94c0c9376836f72a8eab48ed006dd52eee)

* fix dbrx with new logic

* model bugfix

---------

Co-authored-by: 常家瑞 <[email protected]>
Co-authored-by: Even Zhou <[email protected]>
XiaobingSuper pushed a commit to XiaobingSuper/sglang that referenced this pull request Jan 23, 2026
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
…ject#168)

* Copy OSS code from 96fe2d0 on 20251001

* upd

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
rucnyz added a commit to rucnyz/sglang that referenced this pull request Jun 2, 2026
…tor + DP=2 real-run; TP follow-on blocked on sglang patch (sgl-project#174)

verify/t15/detector.py — pure analysis tool over time-series of
per-rank /aginfer/state snapshots.  Window-based eviction diff
across ranks; reports any window where ranks evicted different
hashes.

verify/t15/verify.py — 11 synthetic stages, all green:
  A0/A1 single-rank → no report (no cross-rank comparison)
  B0/B1 multi-rank, no/identical eviction → no report
  C0   rank-0 evicts u1, rank-1 evicts u2 → 1 report
  C1   partial overlap (rank-1 evicts strictly more) → 1 report
  C2   3 ranks: 2 agree + 1 diverges → 1 report
  C3   sustained divergence across 4 windows → 4 reports
  D0   rank-set change between windows → ValueError
  D1   time_counter propagated to reports
  D2   summarise() smoke

verify/t15/run_tp2_real.py — real DP=2 sglang launcher + churn
driver.  102 snapshots over 60 s × 24-worker churn; 13,620 requests;
8,948 peak units in radix tree; detector reported 34/101 divergent
windows (expected-by-design under DP — replicas serve different
program subsets).

State worth recording (caught during wire-up):
  * UnifiedRadixCache is gated behind SGLANG_ENABLE_UNIFIED_RADIX_TREE=1.
    Without it sglang falls back to HiRadixCache and /aginfer/state
    returns {"unsupported_tree_cache": ...} per rank.
  * DP>1 /aginfer/state exposes per_rank; TP>1 does NOT — the
    multi-rank aggregator runs inside http_server.py before the
    HTTP response.

§6 INVARIANT VERIFICATION BLOCKED on sglang patch (sgl-project#174): real TP-rank
divergence test needs a debug endpoint exposing per-TP-rank state
pre-aggregation.  PLAN §2 T15 status updated accordingly.
rucnyz added a commit to rucnyz/sglang that referenced this pull request Jun 2, 2026
…nstant export, T15 honest claims

Round-2 audit on the T12/T13/T15 batch found 3 real issues + 2
real test-depth gaps.  TDD: failing test first where applicable,
then fix.

T12 (sgl-project#127 audit closure):
* B2 was tautological (only asserted isinstance dict) — rewritten
  to force a real curve_fit failure via NaN-in-y and assert at
  least one shape is dropped from the result.
* B3 only covered the linear-vs-power tie — extended to also pin
  the same-k (linear vs hyperbolic) deterministic tie-break.
* B4 NEW: power(γ=15) saturation flagged on FitResult.  Pre-fix:
  curve_fit silently clipped γ to the upper bound 10; FitResult
  had no way to surface this.  Post-fix: FitResult.saturated
  field; fit_one("power", ...) sets it when γ lands within 1% of
  either bound.

T13 (sgl-project#128 audit closure):
* Hoisted LINK_IDLE_SECONDS + LINK_PAIRS from function-local
  constants inside build_paper_state to public module-level
  attributes in daemon/kv_scheduler.py.  verify/t13/ now imports
  them via `kvs.LINK_IDLE_SECONDS` + `kvs.LINK_PAIRS` instead of
  redeclaring — a drift between production and verify is now a
  test failure, not a coincidence in prod.

T15 (sgl-project#168 audit closure):
* Renamed `run_tp2_real.py` → `run_dp2_real.py` (the script
  launches --dp 2; the previous name was misleading).
* Updated docstring + print statements + log filename to say DP=2.
* CRITICAL: the previous README claimed "34/101 divergent windows
  expected-by-design under DP" — but audit caught that without
  hicache content-hash mode active, sglang emits f"node-{node.id}"
  as the unit hash (per-process counter, not content-derived).
  Across DP=2, two unrelated nodes in different processes can
  share the same counter ID, making the divergence count
  meaningless.  Driver now WARNs when all sampled hashes match
  the counter regex; README RESULTS section rewritten to claim
  only parser-integrity, not §6 signal.

T12: 9 → 10 stages.  All green.
T13: 9 stages, all green.
T15: 11 synthetic + 1 real-run driver, all green.

Regression sanity: kv_scheduler_value_rule still 19/19 green
(unaffected by the kv_scheduler.py public-constant hoist).
efschu pushed a commit to efschu/htsglang that referenced this pull request Jul 25, 2026
Completes sgl-project#168. The compressed-tensors family got the fallback in 3cc2fc9,
but the Qwen-schema checkpoints (quant_method: fp8, fmt: e4m3, per-tensor)
do not go through compressed-tensors -- they go through Fp8Config /
Fp8LinearMethod, which was still unreachable on a GPU without an fp8 GEMM.
That is the family the user's checkpoints actually use.

Same structure as the compressed-tensors change: vendor first, functional
probe, the scheme answers whether it needs a device kernel, dequant as the
last branch.

fp8_needs_dequant_fallback() asks, in the order the fast paths are tried,
whether a native fp8 GEMM, cutlass, or Marlin is reachable. If none is, the
only correct route left is dequantise + F.linear.

The capability floor is now conditional. loader.py rejected sm75 outright:
75 < Fp8Config.get_min_capability() == 80. QuantizationConfig gains
needs_device_kernel(); a config that can serve its checkpoint with plain
torch ops has no floor and must not be measured against one. Block-scaled
and mxfp8 keep their floor -- their scale layouts have no plain-torch route.

FIFTH instance of the vendor-namespace collision, and this one is the
generic outer gate for EVERY quantization method: loader.py compares
get_device_capability() (caller's namespace) against get_min_capability()
(NVIDIA numbers), so gfx900's (9, 0) -> 90 clears an 80 floor for any
method. Fixing that for all methods is out of scope here and is left
commented at the site; what is fixed is the case where the method says it
needs no kernel at all.

In process_weights_after_loading the dequant path deliberately joins the
per-channel branch rather than the per-tensor one: that branch needs no
kernel, whereas the per-tensor branch requantises via scaled_fp8_quant --
precisely the kind of kernel the fallback exists because the device lacks.
Keeping the loaded scales also skips a requantisation, so the fallback is if
anything slightly more accurate.

SGLANG_FORCE_FP8_DEQUANT=1 forces the fallback on hardware that has fp8, so
it can be exercised without a card too small for the checkpoints that need
it. This is what makes the model-scale test below runnable on the main rig.

Unit test, synthetic fmt:e4m3, fused QKV-like module with three logical
shards and a different scale each, on both fallback devices:

  sm75   RTX 2080 Ti   parse ok, use_dequant=True, weight stays fp8
                       per-shard scale expansion  EXACT (maxdiff 0.0)
                       apply() vs reference       EXACT (maxdiff 0.0)
                       bias path                  EXACT
  gfx900 Vega 64       identical, all EXACT

Forced-fallback smoke at real layer size (fused QKV of a 27B-class layer,
7168x5120, fp16 compute, batch 64):

  sm75   RTX 2080 Ti   35 MiB fp8 weight, rel err 5.2e-04, 1.07 ms/call
  sm120  RTX 5090      (forced) rel err 7.0e-04, 0.23 ms/call

CUDA unchanged where it matters, verified:

  sm120 RTX 5090   native=True  cutlass=True  -> use_dequant=False
  sm86  RTX 3080   marlin=True                -> use_dequant=False
  both             needs_device_kernel=True   -> floor still enforced

The compressed-tensors routing of 3cc2fc9 was re-checked after these
edits and is unchanged (5090 still routes to W8A8Fp8 native).

NOT TESTED AT MODEL SCALE. There is no small fmt:e4m3 checkpoint to test
with, and the 27B does not fit on the second host's pair. The unit test and
the layer-slice smoke are what is measured; a whole-model run of a Qwen-schema
fp8 checkpoint is not. Check point for that, which the main rig can do in
minutes: run the 27B with SGLANG_FORCE_FP8_DEQUANT=1 and compare token ids
against the same model on its native fp8 path.

MoE fp8 (Fp8MoEMethod) is out of scope and untouched.

One caveat recorded: the probe allocates on the current device and its answer
is cached process-wide. Under one-visible-GPU-per-process (how this fork runs
TP) that is exactly right; a single process driving mixed GPU models would
cache the first device's answer.
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.

2 participants