ThanatosShinji / onnx-tool

A parser, editor and profiler tool for ONNX models.
https://pypi.org/project/onnx-tool/
MIT License
401 stars 52 forks source link

onnx_tools support DIT model? #78

Open ziyanxzy opened 7 months ago

ziyanxzy commented 7 months ago

You need to provide a way to get your model. You can share the model's link or some scripts to create your model. the Dit model below: https://github.com/facebookresearch/DiT

I can successful convert pt model to onnx model, but when i use: m = onnx_tool.Model(model_path) m.graph.shape_infer(example_input) m.graph.profile()

Traceback (most recent call last): File "C:\Users\SAS\projects\DiT\text.py", line 30, in m = onnx_tool.Model(model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SAS\anaconda3\envs\DiT\Lib\site-packages\onnx_tool\model.py", line 26, in init self.graph = Graph(m.graph, self.cfg) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\SAS\anaconda3\envs\DiT\Lib\site-packages\onnx_tool\graph.py", line 179, in init self.init_graph_from_onnxproto(g, self.cfg.node_rename) File "C:\Users\SAS\anaconda3\envs\DiT\Lib\site-packages\onnx_tool\graph.py", line 430, in init_graph_from_onnxproto newnode = create_node(node) ^^^^^^^^^^^^^^^^^ File "C:\Users\SAS\anaconda3\envs\DiT\Lib\site-packages\onnx_tool\node.py", line 2509, in create_node instance = node_class(n) ^^^^^^^^^^^^^ File "C:\Users\SAS\anaconda3\envs\DiT\Lib\site-packages\onnx_tool\node.py", line 921, in init strs = strs[1].split(b'->')


IndexError: list index out of range

is it the onnx_tools not support diffusion transformer?
ziyanxzy commented 7 months ago

this issue in einsum node:

output: "/Einsum_output_0" name: "/Einsum" op_type: "Einsum" attribute { name: "equation" type: STRING s: "nhwpqc->nchpwq" }

shishunwan commented 2 months ago

same error with DIT model https://huggingface.co/stabilityai/stable-diffusion-3-medium-tensorrt/tree/main/mmdit.opt when I using: onnx_tool.model_profile(model_path, save_profile=ouput_path)