@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 0f5b526040
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 23:30 UTC

[Fix] Remove unused packing_position_embedding from PaddleOCRVL for better checkpoint compatibility (#38232)

Signed-off-by: zhangyue66 <zhangyue66@baidu.com>

zhang-prog committed Mar 26, 2026 at 23:34 UTC 0f5b5260401e3c59adec8ffc078ae0f799b08f80
1 file changed +18 -19
vllm/model_executor/models/paddleocr_vl.py
+18 -19
@@ -409,7 +409,6 @@ class SiglipVisionEmbeddings(nn.Module):
409 self.cache_position_embedding = dict()
410 self.cache_position_count = dict()
411 self.position_embedding = nn.Embedding(self.num_positions, self.embed_dim)
412 - self.packing_position_embedding = nn.Embedding(32768, self.embed_dim)
412
413 self.register_buffer(
414 "position_ids",
@@ -501,24 +500,22 @@ class SiglipVisionEmbeddings(nn.Module):
500 patch_embeds = self.patch_embedding(pixel_values.to(dtype=target_dtype))
501 embeddings = patch_embeds.flatten(-2).squeeze(-1)
502
504 - if interpolate_pos_encoding and image_grid_thw is not None:
505 - start = 0
506 - tmp_embeddings = list()
507 - for image_grid in image_grid_thw:
508 - t, h, w = image_grid
509 - end = start + t * h * w
510 - image_embeddings = embeddings[start:end, :]
511 - position_embedding = (
512 - self.interpolate_pos_encoding(image_embeddings, h, w, True)
513 - .squeeze(0)
514 - .repeat(t, 1)
515 - )
516 - image_embeddings = image_embeddings + position_embedding
517 - tmp_embeddings.append(image_embeddings)
518 - start = end
519 - embeddings = torch.concat(tmp_embeddings, dim=0).unsqueeze(0)
520 - else:
521 - embeddings = embeddings + self.packing_position_embedding(position_ids)
503 + start = 0
504 + tmp_embeddings = list()
505 + for image_grid in image_grid_thw:
506 + t, h, w = image_grid
507 + end = start + t * h * w
508 + image_embeddings = embeddings[start:end, :]
509 + position_embedding = (
510 + self.interpolate_pos_encoding(image_embeddings, h, w, True)
511 + .squeeze(0)
512 + .repeat(t, 1)
513 + )
514 + image_embeddings = image_embeddings + position_embedding
515 + tmp_embeddings.append(image_embeddings)
516 + start = end
517 + embeddings = torch.concat(tmp_embeddings, dim=0).unsqueeze(0)
518 +
519 return embeddings
520 else:
521 raise ValueError(
@@ -939,6 +936,8 @@ class SiglipVisionModel(nn.Module):
936 continue
937 if "head.mlp" in name or "head.probe" in name:
938 continue
939 + if "packing_position_embedding" in name:
940 + continue
941 if self.quant_config is not None and (
942 scale_name := self.quant_config.get_cache_scale(name)
943 ):