Skip to content

Commit c8c8ebd

Browse files
Dhenz14root
andauthored
fix(sglang): preserve tie_word_embeddings for single-node runs (#444)
Co-authored-by: root <root@Dan>
1 parent 14a2081 commit c8c8ebd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/parallax/sglang/model_runner.py

100755100644
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,13 @@ def initialize_sgl_model_runner(
349349
dtype=dtype,
350350
quantization=quant_method,
351351
)
352-
# TODO: Fix me
353-
model_config.hf_config.tie_word_embeddings = False
352+
# Only disable tie_word_embeddings when running a partial layer range
353+
# (multi-node PP where this node doesn't have both embed_tokens and lm_head).
354+
# For single-node or full-range runs, keep the original setting so that
355+
# lm_head correctly shares weights with embed_tokens.
356+
num_hidden_layers = model_config.hf_config.num_hidden_layers
357+
if start_layer > 0 or end_layer < num_hidden_layers:
358+
model_config.hf_config.tie_word_embeddings = False
354359
model_config.hf_config.start_layer = start_layer
355360
model_config.hf_config.end_layer = end_layer
356361

0 commit comments

Comments
 (0)