Skip to content

Commit 7036d6f

Browse files
authored
[Bug]: Add missing clamp to llavavid (sgl-project#3787)
1 parent 6ce9dbe commit 7036d6f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python/sglang/srt/models/llavavid.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def forward(
110110
if forward_batch.forward_mode.is_extend():
111111
bs = forward_batch.batch_size
112112

113+
# Clamp input ids. See llava.py for more details
114+
input_ids = input_ids.clamp_(min=0, max=self.config.vocab_size - 1)
115+
113116
# Embed text inputs
114117
input_embeds = self.language_model.model.embed_tokens(input_ids)
115118

0 commit comments

Comments
 (0)