Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tensorrt_llm/_torch/models/modeling_qwen2vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ def _prepare_qwen_vl_mrope_config(
if len(delta_tensors) != num_seq_slots:
raise RuntimeError(
"Missing MRoPE position deltas for seq-slot cache update")
deltas = torch.cat(delta_tensors, dim=0)
# `delta_tensors` originate from per-request `multimodal_data` and may
# be CPU-resident when the owning model's `multimodal_data_device_paths`
# does not cover `mrope_config.*` (or a path skips the engine's H2D
# move), while the seq-slot cache and `seq_slots` live on the model
# device. `index_copy_` requires all tensors on the same device.
deltas = torch.cat(delta_tensors,
dim=0).to(device=mrope_position_deltas_cache.device,
non_blocking=True)
mrope_position_deltas_cache.index_copy_(0, seq_slots, deltas)

if position_ids is not None \
Expand Down
6 changes: 6 additions & 0 deletions tensorrt_llm/_torch/models/modeling_qwen_image_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
class _QwenImageBenchModelMixin:
@property
def multimodal_data_device_paths(self) -> List[str]:
# Keep the mrope_config entries in sync with `_Qwen3_5VLModel`
# (modeling_qwen3_5.py): the shared Qwen-VL mRoPE seq-slot cache path
# consumes `mrope_position_deltas` on the model device, so the engine
# must move them H2D along with the rest of the multimodal payload.
return [
"image.pixel_values",
"video.pixel_values_videos",
"multimodal_embedding",
"mrope_config.mrope_position_ids",
"mrope_config.mrope_position_deltas",
]

@property
Expand Down
Loading