Apply gemma's position offset out-of-place instead of in-place (#26799)
This commit is contained in:
@@ -199,6 +199,7 @@ class Envs:
|
||||
SGLANG_SORT_WEIGHT_FILES = EnvBool(False)
|
||||
SGLANG_DISABLED_MODEL_ARCHS = EnvTuple(tuple())
|
||||
SGLANG_PREFETCH_BLOCK_SIZE_MB = EnvInt(16)
|
||||
SGLANG_GEMMA_OUT_OF_PLACE_POSITION_MUTATION = EnvBool(False)
|
||||
|
||||
# Logging Options
|
||||
SGLANG_LOG_GC = EnvBool(False)
|
||||
|
||||
@@ -29,6 +29,7 @@ from transformers import (
|
||||
)
|
||||
|
||||
from sglang.srt.distributed import get_pp_group
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.layers.attention.triton_backend import TritonAttnBackend
|
||||
from sglang.srt.layers.layernorm import Gemma4RMSNorm
|
||||
from sglang.srt.layers.linear import ReplicatedLinear
|
||||
@@ -595,7 +596,11 @@ class Gemma4ForConditionalGeneration(PreTrainedModel):
|
||||
"You must specify exactly one of input_ids or inputs_embeds"
|
||||
)
|
||||
|
||||
positions += 1
|
||||
if envs.SGLANG_GEMMA_OUT_OF_PLACE_POSITION_MUTATION.get():
|
||||
positions = positions + 1
|
||||
else:
|
||||
positions += 1
|
||||
|
||||
per_layer_inputs = None
|
||||
# PLE table and the per-layer projection live on the first rank only,
|
||||
# so non-first ranks must skip this and pull per_layer_inputs from the
|
||||
|
||||
Reference in New Issue
Block a user