fix: Add default value for backend in sample_mmmu_requests (#12256)

This commit is contained in:
Zaili Wang
2025-10-31 19:31:40 +08:00
committed by GitHub
parent 2d5605e89b
commit 50b6842b4b
2 changed files with 9 additions and 6 deletions

View File

@@ -1014,7 +1014,7 @@ async def get_mooncake_request_over_time(
def sample_mmmu_requests(
num_requests: int,
processor: AutoProcessor | AutoTokenizer,
backend: str,
backend: str = "sglang",
fixed_output_len: Optional[int] = None,
random_sample: bool = True,
) -> List[DatasetRow]:
@@ -1369,7 +1369,10 @@ def create_mm_data_row(
)["input_ids"].numel()
except Exception:
# Fallback: just tokenize the text prompt directly
text_prompt_len = len(processor.tokenizer.encode(text_prompt))
tokenizer_to_use = (
processor.tokenizer if hasattr(processor, "tokenizer") else processor
)
text_prompt_len = len(tokenizer_to_use.encode(text_prompt))
# Vision tokens = total tokens - text tokens
vision_prompt_len = prompt_len - text_prompt_len