Skip to content

Commit 05333b7

Browse files
committed
fix: refactor/simplify conditionals
1 parent e4e6ea2 commit 05333b7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

server/text_generation_server/models/vlm_causal_lm.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ def batch_tokenized_inputs(
236236
image = Image.open(BytesIO(chunk.image.data))
237237
# qwen2_vl expects images to be greater than 20 pixels, this is for warmup since the
238238
# default warmup image is 20x20
239-
if (
240-
config.model_type == "qwen2_vl"
241-
or config.model_type == "qwen2_5_vl"
242-
):
239+
if config.model_type in {"qwen2_vl", "qwen2_5_vl"}:
243240
if image.width <= 20:
244241
w = image.width * 2
245242
h = image.height * 2
@@ -430,10 +427,7 @@ def forward(
430427
max_s = batch.max_current_length
431428
lm_head_indices = batch.prefill_head_indices
432429

433-
if (
434-
self.model.config.model_type == "qwen2_vl"
435-
or self.model.config.model_type == "qwen2_5_vl"
436-
):
430+
if self.model.config.model_type in {"qwen2_vl", "qwen2_5_vl"}:
437431
if position_ids.dim() == 1 and batch.prefilling:
438432
position_ids = self.model.get_position_ids(
439433
input_ids, batch.image_grid_thw

0 commit comments

Comments
 (0)