Repository navigation
Change llama2 to llama - #597
Closed
ZackZeng999 wants to merge 1 commit into
Closed
ZackZeng999 wants to merge 1 commit into
ZackZeng999 wants to merge 1 commit into
Conversation
Ying1123
requested changes
Jul 7, 2024
Ying1123
left a comment
Contributor
There was a problem hiding this comment.
./python/sglang/lang/chat_template.py:8: LLAMA2 = auto()
./python/sglang/lang/chat_template.py:25: if self.style == ChatTemplateStyle.LLAMA2:
./python/sglang/lang/chat_template.py:161: style=ChatTemplateStyle.LLAMA2,
./python/sglang/lang/chat_template.py:267:def match_llama2_chat(model_path: str):
./python/sglang/srt/models/mistral.py:3:from sglang.srt.models.llama2 import LlamaForCausalLM
./python/sglang/srt/models/qwen2.py:1:# Adapted from llama2.py
./python/sglang/srt/models/llava.py:27:from sglang.srt.models.llama2 import LlamaForCausalLM
./python/sglang/srt/models/llama_classification.py:14:from sglang.srt.models.llama2 import LlamaModel
./python/sglang/srt/conversation.py:21: LLAMA2 = auto()
./python/sglang/srt/conversation.py:125: elif self.sep_style == SeparatorStyle.LLAMA2:
./python/sglang/srt/conversation.py:386:# llama2 template
./python/sglang/srt/conversation.py:394: sep_style=SeparatorStyle.LLAMA2,
./benchmark/multi_document_qa/build_dataset.py:6: open("llama2.txt", "r", encoding="utf-8", errors="ignore").readlines()
./benchmark/multi_document_qa/README.md:40:with open('llama2.pdf', 'rb') as file:
./docs/model_support.md:9:1. Compare these two files [SGLang LLaMA Implementation](https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/models/llama2.py) and [vLLM LLaMA Implementation](https://github.com/vllm-project/vllm/blob/main/vllm/model_executor/models/llama.py). This comparison will help you understand how to convert a model implementation from vLLM to SGLang. The major difference is the replacement of PagedAttention with RadixAttention. The other parts are almost identical. Specifically,
Please check carefully and run tests.
merrymercy
force-pushed
the
main
branch
2 times, most recently
from
July 16, 2024 03:44
7eda0c8 to
41d1f67
Compare
zhyncs
reviewed
Jul 18, 2024
zhyncs
left a comment
Contributor
There was a problem hiding this comment.
Hi @ZackZeng999 Why make this change? What is the motivation? As mentioned above, before submitting a pull request, it is necessary to verify locally.
Contributor
|
duplicate #644 |
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 5, 2026
…yerCommunicator (default off)
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Aug 16, 2026
…3 us threshold Desk half of sgl-project#705, the sgl-project#485 phase matrix applied to DECODE as sgl-project#702 applied it to prefill. No GPU touched. Verdict: the desk-net is positive if and only if a blocking TP all-reduce costs more than 14.3 microseconds on this rig. Everything else is priced; the whole question collapses to that one measurable threshold, which is the only number this desk could not source. Two premise corrections, one each way. (a) "20 GB of GDN weights" is ~4x too high for the part that actually moves. The MoE block is 77.7 percent of all weights and does NOT move -- it stays sharded on every layer. Only the GDN attention module relocates: 110.5 MiB per layer, 5,304 MiB total. (b) "75 percent of depth becomes sync-free" is FALSE, and this cuts against the proposal. Every layer is MoE (qwen3_next.py:580, is_layer_sparse = True unconditionally) and the MoE block issues its own all-reduce whenever moe_tp_size > 1 (moe/fused_moe_triton/layer.py:2047, :2062). No layer becomes sync-free at any depth. The removal is 48 of 128 collectives per round, 37.5 percent, not 75 percent of depth. (c) Cutting FOR the proposal: the 48 removed all-reduces are the BLOCKING kind (RowParallelLinear calls tensor_model_parallel_all_reduce synchronously, linear.py:2340), while the surviving MoE all-reduce is DEFERRED and joined in the next layer's prepare_attn (communicator.py:888-891, sgl-project#597). So the removed collectives are worth more per unit than a count comparison suggests. Bandwidth cost, priced: +0.668 ms/round for GDN attention weights (sharded 1,768 MiB each binds on the 3080s at 2.439 ms; solo 5,304 MiB on the 5090 is 3.107 ms) plus +0.018 ms for state, so +0.686 ms/round total -- far below the ticket's ~+5 ms envelope. The reason is that the sharded case is bound by the SLOWEST rank, so trading three slow readers for one fast one costs much less than the aggregate-bandwidth framing implies. Break-even is 0.686 ms / 48 = 14.3 us per collective, a low bar for a PHB round trip on a 10 KB payload. Capacity ledger: rank0 +4,688 MiB (GDN weights +3,536, GDN states +1,152 at 12 mamba slots), each 3080 frees 2,344 MiB, world net EXACTLY ZERO. Here that conservation is correct rather than the sgl-project#702 error: decode really is the TP phase, the pool really is the sum, and the DCP vector really can relieve a tight rank. sgl-project#702's mistake was applying this rule to PP prefill, where the pool is layer-sharded and takes the min. Residual tension named: capacity wants rank0's token share lower, bandwidth wants 2.4:1:1. Recommendation is to hold 2.4:1:1 and absorb the 4,688 MiB out of rank0's KV share, since the world pool is conserved and the 3080s were just handed 2,344 MiB each. Ranks 1/2 become zero-shard for the GDN family per sgl-project#115, an intermediate rung rather than all-or-nothing, as sgl-project#324 per-(rank,family) ratios allow. Ledger gap stated rather than smoothed: the census on disk is the PP layout, so world-neutrality holds as an accounting identity but the per-rank FIT of +4,688 MiB on rank0 is unverified. One conditional A/B arm defined, gated on measuring the break-even first, with the wait column as the acceptance signal and a falsifier on rank0 compute rising by ~0.69 ms and no more. Must not be co-armed with a sgl-project#702 prefill-cut change -- one phase at a time or neither result is attributable. Docs only. No arm, no deploy.
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.
No description provided.