Skip to content

Saving tract_onnx model #1094

Answered by kali
igor-yusupov asked this question in Q&A
Discussion options

You must be logged in to vote

You can dump a model in nnef form, right after decluttering, before optimising(). The size shoud be roughly the same, most of a model size is made of the trained parameters.

On the other hand, you may get a shorter loading time because the expensive decluttering is already done...

You can look for inspiration here: https://github.com/sonos/tract/tree/main/examples/nnef-dump-mobilenet-v2 . This show how to load NNEF model.

For converting and dumping your model, load it as usual, but call https://docs.rs/tract-core/latest/tract_core/model/typed/type.TypedModel.html#method.into_decluttered instead of into_optimized() (optimized model are NOT serializable to NNEF). Then you can use https://do…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by igor-yusupov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants