mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-06-19 15:52:08 +00:00
fix: refactor/simplify conditionals
This commit is contained in:
parent
e4e6ea2598
commit
05333b7cbe
@ -236,10 +236,7 @@ class VlmCausalLMBatch(FlashCausalLMBatch):
|
|||||||
image = Image.open(BytesIO(chunk.image.data))
|
image = Image.open(BytesIO(chunk.image.data))
|
||||||
# qwen2_vl expects images to be greater than 20 pixels, this is for warmup since the
|
# qwen2_vl expects images to be greater than 20 pixels, this is for warmup since the
|
||||||
# default warmup image is 20x20
|
# default warmup image is 20x20
|
||||||
if (
|
if config.model_type in {"qwen2_vl", "qwen2_5_vl"}:
|
||||||
config.model_type == "qwen2_vl"
|
|
||||||
or config.model_type == "qwen2_5_vl"
|
|
||||||
):
|
|
||||||
if image.width <= 20:
|
if image.width <= 20:
|
||||||
w = image.width * 2
|
w = image.width * 2
|
||||||
h = image.height * 2
|
h = image.height * 2
|
||||||
@ -430,10 +427,7 @@ class VlmCausalLM(FlashCausalLM):
|
|||||||
max_s = batch.max_current_length
|
max_s = batch.max_current_length
|
||||||
lm_head_indices = batch.prefill_head_indices
|
lm_head_indices = batch.prefill_head_indices
|
||||||
|
|
||||||
if (
|
if self.model.config.model_type in {"qwen2_vl", "qwen2_5_vl"}:
|
||||||
self.model.config.model_type == "qwen2_vl"
|
|
||||||
or self.model.config.model_type == "qwen2_5_vl"
|
|
||||||
):
|
|
||||||
if position_ids.dim() == 1 and batch.prefilling:
|
if position_ids.dim() == 1 and batch.prefilling:
|
||||||
position_ids = self.model.get_position_ids(
|
position_ids = self.model.get_position_ids(
|
||||||
input_ids, batch.image_grid_thw
|
input_ids, batch.image_grid_thw
|
||||||
|
Loading…
Reference in New Issue
Block a user