-m yobx mermaid … convert an onnx model into Mermaid flowchart format#
The command converts an onnx model into a Mermaid flowchart string that can be embedded in Markdown, GitHub READMEs, or any tool that renders Mermaid diagrams.
Description#
See yobx.helpers.mermaid_helper.to_mermaid().
usage: mermaid [-h] [-o OUTPUT] [-v VERBOSE] input
Converts a model into a Mermaid flowchart string.
positional arguments:
input onnx model to convert
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
file to save the Mermaid output or empty to print out the result
-v VERBOSE, --verbose VERBOSE
verbosity
Examples#
Print the Mermaid source to the terminal:
python -m yobx mermaid model.onnx
Save the Mermaid source to a file:
python -m yobx mermaid model.onnx -o model.mmd
Output on a Dummy Model#
The following block builds a small Add + Relu model on the fly and runs
the command to show what the output actually looks like.
flowchart TD
I_0["X\nFLOAT(2,3)"]:::input
I_1["Y\nFLOAT(2,3)"]:::input
Add_2["Add(., .)"]:::op
Relu_3["Relu(.)"]:::op
I_0 -->|"FLOAT(2,3)"| Add_2
I_1 -->|"FLOAT(2,3)"| Add_2
Add_2 -->|"FLOAT(2,3)"| Relu_3
O_4["Z\nFLOAT(2,3)"]:::output
Relu_3 --> O_4
classDef input fill:#aaeeaa,stroke:#00aa00,color:#000
classDef init fill:#cccc00,stroke:#888800,color:#000
classDef op fill:#cccccc,stroke:#666666,color:#000
classDef output fill:#aaaaee,stroke:#0000aa,color:#000