Skip to content

Commit c9db73e

Browse files
committed
Modify unit test
1 parent be6c928 commit c9db73e

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

tests/lora/test_minicpmv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def do_sample(llm: vllm.LLM, lora_path: str, lora_id: int) -> List[str]:
5656
def test_minicpmv_lora(minicpmv_lora_files):
5757
llm = vllm.LLM(
5858
MODEL_PATH,
59-
max_model_len=1024,
59+
max_num_seqs=2,
6060
enable_lora=True,
6161
max_loras=4,
6262
max_lora_rank=64,

tests/lora/test_minicpmv_tp.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
PROMPT_TEMPLATE = (
1414
"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\n"
1515
"(<image>./</image>)\nWhat is in the image?<|eot_id|>"
16-
"<|start_header_id|>assistant<|end_header_id|>\n\n"
17-
)
16+
"<|start_header_id|>assistant<|end_header_id|>\n\n")
1817

1918
IMAGE_ASSETS = [
2019
ImageAsset("stop_sign"),
@@ -35,20 +34,18 @@ def do_sample(llm: vllm.LLM, lora_path: str, lora_id: int) -> List[str]:
3534
stop_token_ids=[128001, 128009], # eos_id, eot_id
3635
)
3736

38-
inputs = [
39-
{
40-
"prompt": PROMPT_TEMPLATE,
41-
"multi_modal_data": {"image": asset.pil_image},
42-
}
43-
for asset in IMAGE_ASSETS
44-
]
37+
inputs = [{
38+
"prompt": PROMPT_TEMPLATE,
39+
"multi_modal_data": {
40+
"image": asset.pil_image
41+
},
42+
} for asset in IMAGE_ASSETS]
4543

4644
outputs = llm.generate(
4745
inputs,
4846
sampling_params,
4947
lora_request=LoRARequest(str(lora_id), lora_id, lora_path)
50-
if lora_id
51-
else None,
48+
if lora_id else None,
5249
)
5350
# Print the outputs.
5451
generated_texts: List[str] = []
@@ -59,13 +56,14 @@ def do_sample(llm: vllm.LLM, lora_path: str, lora_id: int) -> List[str]:
5956
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
6057
return generated_texts
6158

59+
6260
@multi_gpu_test(num_gpus=2)
6361
@pytest.mark.parametrize("fully_sharded", [True, False])
6462
def test_minicpmv_tp2(minicpmv_lora_files, fully_sharded):
6563
llm = vllm.LLM(
6664
MODEL_PATH,
6765
enable_lora=True,
68-
max_num_seqs=16,
66+
max_num_seqs=2,
6967
max_loras=4,
7068
max_lora_rank=64,
7169
tensor_parallel_size=2,
@@ -85,7 +83,7 @@ def test_minicpmv_tp4(minicpmv_lora_files, fully_sharded):
8583
llm = vllm.LLM(
8684
MODEL_PATH,
8785
enable_lora=True,
88-
max_num_seqs=16,
86+
max_num_seqs=2,
8987
max_loras=4,
9088
max_lora_rank=64,
9189
tensor_parallel_size=4,

0 commit comments

Comments
 (0)