Skip to content

Commit 782ecfb

Browse files
committed
fix
1 parent 6692cd0 commit 782ecfb

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

_scripts/export_qwen25_vl_visual.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
export visual embedding of Qwen/Qwen2.5-VL-7B-Instruct
2+
Export visual embedding of Qwen/Qwen2.5-VL-7B-Instruct
33
======================================================
44
55
requirements
@@ -12,12 +12,12 @@
1212
torch>=2.9 # weekly is better
1313
transformers>=4.57
1414
15-
example
16-
+++++++
15+
Examples
16+
++++++++
1717
1818
.. code-block:: bash
1919
20-
python export_qwen25_vl_visual.py -m Qwen/Qwen2.5-VL-7B-Instruct --device cpu --dtype float32 --exporter custom --pretrained --second-input
20+
python export_qwen25_vl_visual.py -m Qwen/Qwen2.5-VL-7B-Instruct --device cpu --dtype float32 --exporter onnx-dynamo --pretrained --second-input
2121
"""
2222

2323
import os
@@ -38,6 +38,10 @@ def remove_inplace_body_last_input_output_type_for_loop(filename: str):
3838
onnx.save(model, filename, save_as_external_data=False)
3939

4040

41+
def simplify_model_id_for_a_filename(model_id: str) -> str:
42+
return model_id.lower().replace("/", ".")
43+
44+
4145
def main(
4246
model_id: str = "Qwen/Qwen2.5-VL-7B-Instruct",
4347
device: str = "cpu",
@@ -140,7 +144,8 @@ def _config_reduction(config, task):
140144
grid_thw={}, # {0: "n_images"}, # TODO: fix
141145
)
142146

143-
filename = f"qwen25_vli_visual.{device}.{dtype}.{exporter}.onnx"
147+
prefix = simplify_model_id_for_a_filename(model_id)
148+
filename = f"model.{prefix}.visual.{device}.{dtype}.{exporter}.onnx"
144149
print(f"-- export in {filename!r}")
145150
stat_file = filename.replace(".onnx", ".stats")
146151
begin = time.perf_counter()

0 commit comments

Comments
 (0)