@ -14,13 +14,13 @@ Then `onnx-modifier` comes. With it, we can focus on editing the model graph in
Currently, the following editing operations are supported:
- Delete/recover nodes
- [x] Delete/recover nodes
- Delete a single node.
- Delete a node and all the nodes rooted on it.
- Recover a deleted node.
- Rename the name of node inputs/outputs
- Edit the attribute of nodes
- Add new nodes (experimental)
- [x] Rename the name of node inputs/outputs
- [x] Edit the attribute of nodes
- [x] Add new nodes (experimental)
Hope it helps!
@ -48,7 +48,7 @@ Click the url in the output info generated by flask (`http://127.0.0.1:5000/` fo
Click `Open Model...` to upload the ONNX model to edit. The model will be parsed and shown on the page.
# Usage
Graph-level-operation elements are placed on the left-top of the page. Currently, there are four buttons: `Preview`, `Reset`, `Download` and `Add node`. They can do:
Graph-level-operation elements are placed on the left-top of the page. Currently, there are four buttons: `Refresh`, `Reset`, `Download` and `Add node`. They can do:
- `Refresh`: Refresh the model graph to preview editing effects.
> In this version, the model graph is refreshed automatically as soon as an editing operation is invoked. So this button can be used much fewer than earlier versions.
@ -83,7 +83,7 @@ For example, Now we want remove the preprocess operators (`Sub->Mul->Sub->Trans
2. The model graph is updated automatically and we can see the input node links to the 1st `Conv`directly. In addition, the preprocess operators have been split from the main routine. Delete them.
3. We are done! (click `Download`, then we can get the modified ONNX model).
> Note: To link node $A$ (`data_0` in the above example) to node $B$ (the 1st `Conv` in the above example), **it is suggested to edit the input of node $B$ to the output of node `A`, rather than edit the output of node $A$ to the input of node `B`.** Because the input of $B$ can also be other node's output and unexpected result will happen.
> Note: To link node $A$ (`data_0` in the above example) to node $B$ (the 1st `Conv` in the above example), **it is suggested to edit the input of node $B$ to the output of node `A`, rather than edit the output of node $A$ to the input of node `B`.** Because the input of $B$ can also be other node's output (`Transpose` in the above example ) and unexpected result will happen.
The process is shown in the following figure:
@ -93,15 +93,21 @@ The process is shown in the following figure:
Change the original attribute to a new value, then we are done.
> By clicking the `+` in the right side of placeholder, we can get some helpful reference.
Sometimes we want to add new nodes into the exsited model. `onnx-modifier` supports this feature experimentally now.
Sometimes we want to add new nodes into the existed model. `onnx-modifier` supports this feature experimentally now.
Note there is an `Add node` button, following with a selector elements on the top-left of the index page. To do this, what we need to do is as easy as 3 steps:
1. Choose a node type in the selector, and click `Add node` button. Then an empty node of the chosen type will emerge on the graph.
> The selector contains all the supported operator types in domains of `ai.onnx`(171), `ai.onnx.preview.training`(4), `ai.onnx.ml`(18) and `com.microsoft`(1).
2. Click the new node and edit it in the invoked siderbar. What we need to fill are the node Attributes (`undefined` by default) and its Inputs/Outputs (which decide where the node will be inserted in the graph).
@ -120,7 +126,7 @@ The following are some notes for this feature:
6. For the `Inputs/Outputs` with type `list`, it is forced to be at most 8 elements in the current version. If the actual inputs/outputs number is less than 8, we can leave the unused items with the name starting with `list_custom`, and they will be automatically omitted.
7. This feature is experimentally supported now and may be not very rebust. So any issues are warmly welcomed if some unexpected result is encountered.
7. This feature is experimentally supported now and may be not very robust. So any issues are warmly welcomed if some unexpected result is encountered.