[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:
@@ -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[
|
||||
|
||||
Reference in New Issue
Block a user