Skip to content

Commit c0f21bd

Browse files
committed
Added Jenkins stage for VLM tests.
Added a seperate tag for vlm testing in jenkins. Addressed comments. Signed-off-by: quic-dhirajku <quic_dhirajku@quicinc.com>
1 parent 1dd46d4 commit c0f21bd

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

QEfficient/utils/test_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414
# Processor class for InternVL models
1515
class InternProcessor:
16+
"""
17+
InternVL model only has an AutoTokenizer so this class performs the processing tasks similar to an AutoProcessor.
18+
The methods used here are borrowed from the original InternVL modelling files.
19+
"https://huggingface.co/OpenGVLab/InternVL2_5-1B/"
20+
"""
21+
1622
def __init__(self, model: nn.Module, tokenizer):
1723
self.model = model
1824
image_size = self.model.config.force_image_size or self.model.config.vision_config.image_size

scripts/Jenkinsfile

+18-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pipeline {
2424
pip install .[test] &&
2525
pip install junitparser pytest-xdist &&
2626
pip install librosa==0.10.2 soundfile==0.13.1 && #packages needed to load example for whisper testing
27+
pip install --extra-index-url https://download.pytorch.org/whl/cpu timm==1.0.14 torchvision==0.19.1+cpu einops==0.8.1 && #packages to load VLMs
2728
rm -rf QEfficient"
2829
'''
2930
}
@@ -63,6 +64,22 @@ pipeline {
6364
}
6465
}
6566
}
67+
stage('Run Non-CLI QAIC MultiModal Tests') {
68+
steps {
69+
timeout(time: 60, unit: 'MINUTES') {
70+
sh '''
71+
sudo docker exec ${BUILD_TAG} bash -c "
72+
cd /efficient-transformers &&
73+
. preflight_qeff/bin/activate &&
74+
mkdir -p $PWD/Non_cli_qaic_multimodal &&
75+
export TOKENIZERS_PARALLELISM=false &&
76+
export QEFF_HOME=$PWD/Non_cli_qaic_multimodal &&
77+
pytest tests -m '(not cli) and (on_qaic) and (multimodal) and (not qnn)' -n 4 --junitxml=tests/tests_log6.xml &&
78+
deactivate"
79+
'''
80+
}
81+
}
82+
}
6683
}
6784
}
6885
stage('CLI Tests') {
@@ -114,7 +131,7 @@ pipeline {
114131
export TOKENIZERS_PARALLELISM=false &&
115132
export QEFF_HOME=$PWD/Qnn_non_cli &&
116133
pytest tests -m '(not cli) and (qnn) and (on_qaic)' --junitxml=tests/tests_log5.xml &&
117-
junitparser merge tests/tests_log1.xml tests/tests_log2.xml tests/tests_log3.xml tests/tests_log4.xml tests/tests_log5.xml tests/tests_log.xml &&
134+
junitparser merge tests/tests_log1.xml tests/tests_log2.xml tests/tests_log3.xml tests/tests_log4.xml tests/tests_log5.xml tests/tests_log6.xml tests/tests_log.xml &&
118135
deactivate"
119136
'''
120137
}

tests/transformers/models/test_image_text_to_text_models.py

+23-11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
HF_TOKEN = ""
3131
NEW_GENERATION_TOKENS = 10
3232
test_models_config = [
33+
# CONFIG PARAMS NEEDED FOR A MODEL TO BE TESTED
34+
# (
35+
# model_name,
36+
# batch_size,
37+
# prompt_len,
38+
# ctx_len,
39+
# img_size,
40+
# img_url",
41+
# text_prompt,
42+
# number of layers of the model,
43+
# ),
3344
(
3445
"llava-hf/llava-1.5-7b-hf",
3546
1,
@@ -40,16 +51,16 @@
4051
"What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud",
4152
1,
4253
),
43-
(
44-
"meta-llama/Llama-3.2-11B-Vision-Instruct",
45-
1,
46-
32,
47-
512,
48-
560,
49-
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg",
50-
"Explain this image",
51-
4,
52-
),
54+
# (
55+
# "meta-llama/Llama-3.2-11B-Vision-Instruct",
56+
# 1,
57+
# 32,
58+
# 512,
59+
# 560,
60+
# "https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg",
61+
# "Explain this image",
62+
# 4,
63+
# ),
5364
]
5465

5566
intern_model_config = [
@@ -127,7 +138,6 @@ def check_image_text_to_text_pytorch_vs_kv_vs_ort_vs_ai100(
127138
config = AutoConfig.from_pretrained(
128139
model_config["model_name"], token=HF_TOKEN, trust_remote_code=True, padding=True
129140
)
130-
config._attn_implementation = "eager"
131141
config = set_num_layers(config, n_layer=n_layer)
132142
model_hf, _ = load_image_text_to_text_model(config)
133143
processor = AutoProcessor.from_pretrained(model_name, token=HF_TOKEN, trust_remote_code=True, padding=True)
@@ -278,6 +288,7 @@ def check_intern_image_text_to_text_pytorch_vs_kv_vs_ort_vs_ai100(
278288

279289

280290
@pytest.mark.on_qaic
291+
@pytest.mark.multimodal
281292
@pytest.mark.parametrize(
282293
"model_name, batch_size, prompt_len, ctx_len, img_size, img_url, query, n_layer", test_models_config
283294
)
@@ -306,6 +317,7 @@ def test_image_text_to_text_pytorch_vs_kv_vs_ort_vs_ai100(
306317

307318

308319
@pytest.mark.on_qaic
320+
@pytest.mark.multimodal
309321
@pytest.mark.parametrize("model_name, batch_size, prompt_len, ctx_len, img_url, query, n_layer", intern_model_config)
310322
def test_image_text_to_text_intern_pytorch_vs_kv_vs_ort_vs_ai100(
311323
model_name, batch_size, prompt_len, ctx_len, img_url, query, n_layer

0 commit comments

Comments
 (0)