[Fix] model init / XPU / transformers-v5 / bench-image fixes (#28292)
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b42c79c4eb
commit
e63b57da0b
@@ -115,7 +115,10 @@ def create_mm_data_row(
|
||||
# Note (Xinyuan): This is a workaround for an issue where some tokenizers do not support content as a list. (e.g. InternVL)
|
||||
print(f"Error applying chat template: {e}, fallback to <image> tag")
|
||||
# Some tokenizers do not support list content; fall back to a placeholder in the text
|
||||
prompt_str = f"<image>{text_prompt}"
|
||||
if type(processor).__name__ == "MiniCPMOProcessor":
|
||||
prompt_str = f"(<image>./</image>){text_prompt}"
|
||||
else:
|
||||
prompt_str = f"<image>{text_prompt}"
|
||||
|
||||
# Calculate total tokens (text + vision)
|
||||
if type(processor).__name__ == "KimiK25Processor":
|
||||
@@ -125,6 +128,12 @@ def create_mm_data_row(
|
||||
medias=medias,
|
||||
return_tensors="pt",
|
||||
)["input_ids"].numel()
|
||||
elif type(processor).__name__ == "VLChatProcessor":
|
||||
prompt_len = processor(
|
||||
prompt=prompt_str,
|
||||
images=images,
|
||||
force_batchify=False,
|
||||
)["input_ids"].numel()
|
||||
elif type(processor).__name__ == "DeepseekVLV2Processor":
|
||||
result = processor(
|
||||
conversations=prompt_str,
|
||||
|
||||
Reference in New Issue
Block a user