Repository navigation
[Fix] Reduce memory usage for loading llava model & Remove EntryClassRemapping - #1308
Merged
Merged
Conversation
merrymercy
force-pushed
the
fix-llava
branch
from
September 3, 2024 04:20
2c70b62 to
08da60d
Compare
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 14, 2026
…ot's cushion Stage 2 wired cushion_headroom_gib into choose()'s ARM point, but prior_cushion_min_gib/prior_bounce_gib were operator-typed only -- an INERT gate, since nobody types two numbers by hand before a real boot, and the next boot (BOOT7, d6c3d19) would never pass them. Adds host_ledger.flip_ratchet_candidates()/resolve_prior_cushion(): every FLIP-group sidecar entry of an EXACT form_key match (never newest-by-mtime -- sgl-project#1308's own shortcut cost two boots that way), taking the MINIMUM cushion_min over those candidates (never the newest -- the direction is asymmetric, a prior cushion read too high would loosen every boot after it, the sgl-project#782 ratchet-from-the-free-column class in the threshold direction). Both cushion_min_gib and xchg_bounce_gib must come from the SAME candidate record, never mixed across two boots that never coexisted. front.py._write_flip_ratchet now also writes xchg_bounce_gib (from the same ledger_arm dict dormant_image_sample already reads it from) beside the existing cushion_min_gib field, so a future boot's record carries both halves resolve_prior_cushion needs. flip_ratchet_record() gets the new optional xchg_bounce_gib parameter (None-default, byte-identical for every existing caller). launcher.choose_host_ledger gains flip_ratchet_form_key (main passes f"wtags={len(weights_tags)}", the exact literal front.py writes) and self-resolves prior_cushion_min_gib/prior_bounce_gib from the sidecar unless the operator's flags override them outright. A WEG2-CUSHION-HEADROOM-SOURCE line is always appended -- auto-resolved, overridden, or "could not measure (no candidate of this form / no form_key passed)" -- never silent. choose() itself is unchanged from Stage 2. Tests: test_weg2_cushion_headroom_autoresolve_1378_stage2b.py (12 cases) -- pure-resolver form/minimum correctness, front.py's one-producer wiring, and end-to-end through the real choose_host_ledger seam (fake /proc/meminfo + fake cgroup2 tree + a real sidecar file): no-flags-no-form-key is the byte-identical Stage-2 default, form-key-alone auto-resolves, an explicit flag overrides the sidecar (not the reverse), a foreign-form candidate never wins through the real seam, and the minimum (not the newest) of several same-form candidates wins through the real seam. Updated one Stage-2 structural test whose asserted forwarding text changed (raw params -> resolved locals). Manually verified both required danger-direction mutants: (1) min -> max in resolve_prior_cushion: 2 of 12 tests go red (the two through-the-seam and pure-resolver minimum tests); (2) the form_key equality filter dropped: 3 of 12 go red (the foreign-form and no-candidate-of-this-form tests). Both restored, diff empty. Regression run also caught and fixed a genuine bug this diff introduced: test_weg2_flip_ratchet_1350.py's FrontEmitterSmoke1350._Stub lacked ledger_arm, which a real Front always sets in __init__ -- AttributeError on the new call site. Fixed by adding ledger_arm={} to the stub, matching the real invariant, not by making front.py defensively getattr around a state a real instance never lacks. 306 tests green across the wider weg2 regression slice after the fix (previously-noted pre-existing failures in test_weg2_run_residual_currency_1325.py confirmed unrelated by running against the pristine pre-Stage-2b tip in a throwaway worktree, both same three failures present there).
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 14, 2026
…ot's cushion Stage 2 wired cushion_headroom_gib into choose()'s ARM point, but prior_cushion_min_gib/prior_bounce_gib were operator-typed only -- an INERT gate, since nobody types two numbers by hand before a real boot, and the next boot (BOOT7, d6c3d19) would never pass them. Adds host_ledger.flip_ratchet_candidates()/resolve_prior_cushion(): every FLIP-group sidecar entry of an EXACT form_key match (never newest-by-mtime -- sgl-project#1308's own shortcut cost two boots that way), taking the MINIMUM cushion_min over those candidates (never the newest -- the direction is asymmetric, a prior cushion read too high would loosen every boot after it, the sgl-project#782 ratchet-from-the-free-column class in the threshold direction). Both cushion_min_gib and xchg_bounce_gib must come from the SAME candidate record, never mixed across two boots that never coexisted. front.py._write_flip_ratchet now also writes xchg_bounce_gib (from the same ledger_arm dict dormant_image_sample already reads it from) beside the existing cushion_min_gib field, so a future boot's record carries both halves resolve_prior_cushion needs. flip_ratchet_record() gets the new optional xchg_bounce_gib parameter (None-default, byte-identical for every existing caller). launcher.choose_host_ledger gains flip_ratchet_form_key (main passes f"wtags={len(weights_tags)}", the exact literal front.py writes) and self-resolves prior_cushion_min_gib/prior_bounce_gib from the sidecar unless the operator's flags override them outright. A WEG2-CUSHION-HEADROOM-SOURCE line is always appended -- auto-resolved, overridden, or "could not measure (no candidate of this form / no form_key passed)" -- never silent. choose() itself is unchanged from Stage 2. Tests: test_weg2_cushion_headroom_autoresolve_1378_stage2b.py (12 cases) -- pure-resolver form/minimum correctness, front.py's one-producer wiring, and end-to-end through the real choose_host_ledger seam (fake /proc/meminfo + fake cgroup2 tree + a real sidecar file): no-flags-no-form-key is the byte-identical Stage-2 default, form-key-alone auto-resolves, an explicit flag overrides the sidecar (not the reverse), a foreign-form candidate never wins through the real seam, and the minimum (not the newest) of several same-form candidates wins through the real seam. Updated one Stage-2 structural test whose asserted forwarding text changed (raw params -> resolved locals). Manually verified both required danger-direction mutants: (1) min -> max in resolve_prior_cushion: 2 of 12 tests go red (the two through-the-seam and pure-resolver minimum tests); (2) the form_key equality filter dropped: 3 of 12 go red (the foreign-form and no-candidate-of-this-form tests). Both restored, diff empty. Regression run also caught and fixed a genuine bug this diff introduced: test_weg2_flip_ratchet_1350.py's FrontEmitterSmoke1350._Stub lacked ledger_arm, which a real Front always sets in __init__ -- AttributeError on the new call site. Fixed by adding ledger_arm={} to the stub, matching the real invariant, not by making front.py defensively getattr around a state a real instance never lacks. 306 tests green across the wider weg2 regression slice after the fix (previously-noted pre-existing failures in test_weg2_run_residual_currency_1325.py confirmed unrelated by running against the pristine pre-Stage-2b tip in a throwaway worktree, both same three failures present there).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
python/sglang/srt/models/llama2.py->python/sglang/srt/models/llama.py