fix: Add default value for backend in sample_mmmu_requests (#12256)
This commit is contained in:
@@ -1014,7 +1014,7 @@ async def get_mooncake_request_over_time(
|
|||||||
def sample_mmmu_requests(
|
def sample_mmmu_requests(
|
||||||
num_requests: int,
|
num_requests: int,
|
||||||
processor: AutoProcessor | AutoTokenizer,
|
processor: AutoProcessor | AutoTokenizer,
|
||||||
backend: str,
|
backend: str = "sglang",
|
||||||
fixed_output_len: Optional[int] = None,
|
fixed_output_len: Optional[int] = None,
|
||||||
random_sample: bool = True,
|
random_sample: bool = True,
|
||||||
) -> List[DatasetRow]:
|
) -> List[DatasetRow]:
|
||||||
@@ -1369,7 +1369,10 @@ def create_mm_data_row(
|
|||||||
)["input_ids"].numel()
|
)["input_ids"].numel()
|
||||||
except Exception:
|
except Exception:
|
||||||
# Fallback: just tokenize the text prompt directly
|
# 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 tokens = total tokens - text tokens
|
||||||
vision_prompt_len = prompt_len - text_prompt_len
|
vision_prompt_len = prompt_len - text_prompt_len
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ class FakeTokenizer:
|
|||||||
def send_one_batch(base_url, num_prompts, batch_size, tokenizer, is_multimodal):
|
def send_one_batch(base_url, num_prompts, batch_size, tokenizer, is_multimodal):
|
||||||
# format: (prompt, input_len, output len). We set input_len as a dummy value 0.
|
# format: (prompt, input_len, output len). We set input_len as a dummy value 0.
|
||||||
if is_multimodal:
|
if is_multimodal:
|
||||||
|
backend = "sglang-oai-chat"
|
||||||
|
api_url = f"{base_url}/v1/chat/completions"
|
||||||
input_requests = sample_mmmu_requests(
|
input_requests = sample_mmmu_requests(
|
||||||
num_prompts,
|
num_prompts,
|
||||||
tokenizer,
|
tokenizer,
|
||||||
512,
|
backend=backend,
|
||||||
apply_chat_template=False,
|
fixed_output_len=512,
|
||||||
)
|
)
|
||||||
backend = "sglang-oai-chat"
|
|
||||||
api_url = f"{base_url}/v1/chat/completions"
|
|
||||||
else:
|
else:
|
||||||
padded_prompts = (prompts * ((num_prompts + len(prompts) - 1) // len(prompts)))[
|
padded_prompts = (prompts * ((num_prompts + len(prompts) - 1) // len(prompts)))[
|
||||||
:num_prompts
|
:num_prompts
|
||||||
|
|||||||
Reference in New Issue
Block a user