Skip to content

Does Zuko allow exporting to ONNX? #45

Answered by francois-rozet
CaioDaumann asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @CaioDaumann,

I have never tried, but I think it should be possible. Looking at https://pytorch.org/tutorials/beginner/onnx/export_simple_model_to_onnx_tutorial.html, you will probably need to wrap the flow as a "pure function", that is something that takes tensors as input and returns tensors as output. This is not the case of the Flow objects which take a tensor as input and returns a Distribution. A very thin wrapper module that takes both $c$ and $x$ as input and returns $\log p(x | c)$ is probably enough.

Also, I don't know how ONNX handles randomness, but sampling from the flow requires first sampling from the base distribution, and then transforming it. It might be easier to …

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
3 replies
@CaioDaumann
Comment options

@dpbigler
Comment options

@CaioDaumann
Comment options

Answer selected by CaioDaumann
Comment options

You must be logged in to vote
6 replies
@CaioDaumann
Comment options

@francois-rozet
Comment options

@CaioDaumann
Comment options

@francois-rozet
Comment options

@CaioDaumann
Comment options

Comment options

You must be logged in to vote
4 replies
@francois-rozet
Comment options

@CaioDaumann
Comment options

@francois-rozet
Comment options

@CaioDaumann
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants