[Perf] Avoid more GPU<->CPU syncs on the model execution path (#51738)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Nick Hill
2026-08-11 19:30:34 -07:00
committed by GitHub
parent 23f25aac14
commit f97e502969
15 changed files with 116 additions and 56 deletions
+3 -2
View File
@@ -200,7 +200,7 @@ class Step3VLMultiModalProcessor(BaseMultiModalProcessor[Step3VLProcessingInfo])
patch_pixel_values=MultiModalFieldConfig.flat_from_sizes(
"image", num_patches
),
num_patches=MultiModalFieldConfig.batched("image"),
num_patches=MultiModalFieldConfig.batched("image", keep_on_cpu=True),
patch_newline_mask=MultiModalFieldConfig.flat_from_sizes(
"image", num_patches
),
@@ -682,7 +682,8 @@ class Step3VLForConditionalGeneration(
merged_image_features = []
cur_patch_idx = 0
for i, num_patch in enumerate(num_patches):
num_patches_list = num_patches.tolist()
for i, num_patch in enumerate(num_patches_list):
cur_feature = []
if num_patch > 0:
patch_slice = patch_image_features[