Skip to content

Commit c8cf322

Browse files
committed
Reformat code
Signed-off-by: quic-sanising <sanising@qti.qualcomm.com>
1 parent 6dede8c commit c8cf322

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

examples/image_text_to_text/models/qwen_vl/multi_specialization_inference.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from QEfficient import QEFFAutoModelForImageTextToText
1515

16-
## For AWQ model update pytorch version to 2.8.*
16+
# For AWQ model update pytorch version to 2.8.*
1717
model_id = "Qwen/Qwen2.5-VL-3B-Instruct"
1818
config = AutoConfig.from_pretrained(model_id)
1919
config.text_config.num_hidden_layers = 2
@@ -24,13 +24,10 @@
2424
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
2525
processor = AutoProcessor.from_pretrained(model_id)
2626

27-
### use skip_vision=Ture, if want to run only text, ow false ###
27+
# use skip_vision=True, if want to run only text
2828
skip_vision = False
2929

30-
if skip_vision:
31-
## Only Text ##
32-
33-
## Set Batch_Size ##
30+
if skip_vision: # Only Text
3431
batch_size = 1
3532
qeff_model.compile(
3633
batch_size=batch_size,
@@ -77,14 +74,13 @@
7774
print(tokenizer.batch_decode(output.generated_ids))
7875
print(output)
7976

80-
else:
77+
else: # Vision + Text
8178
batch_size = 1
8279
ctx_len = 14336
8380
widths = [360, 320, 360, 454, 536, 640, 720, 910, 720, 1280, 1920]
8481
heights = [120, 180, 240, 256, 354, 360, 480, 512, 576, 720, 1080]
8582
num_frames = [177, 139, 78, 64, 37, 30, 20, 16, 16, 7, 7]
8683

87-
## Vision + Text ##
8884
qeff_model.compile(
8985
batch_size=batch_size,
9086
prefill_seq_len=128,
@@ -104,10 +100,9 @@
104100
mos=1,
105101
)
106102

107-
### IMAGE + TEXT ###
108103
image_url = "https://picsum.photos/id/237/536/354"
109104
image = Image.open(requests.get(image_url, stream=True).raw)
110-
image = image.resize((360, 120)) # Resize to any deimnsion present in specializations (width, height)
105+
image = image.resize((360, 120)) # Resize to any dimension (width, height) present in specializations
111106
messages_1 = [
112107
{
113108
"role": "user",

0 commit comments

Comments
 (0)