How to export nougat model to onnx?

#8
by zhichyu - opened

Here's one exported to onnx https://huggingface.co/pszemraj/nougat-small-onnx.
There are three onnx model files after export: decoder_model.onnx, decoder_with_past_model.onnx, encoder_model.onnx.
However the author doesn't provide the details how he did that.

torch.onnx.export only export one model file model.onnx, and ORTModelForVision2Seq connot load it:

FileNotFoundError: Could not find any ONNX model file for the regex ['(.*)?decoder((?!(with_past|merged)).)*?\\.onnx'] in /home/zhichyu/model_dir/nougat.

Got clue from https://github.com/facebookresearch/nougat/issues/49
optimum-cli will take care all of that.

zhichyu changed discussion status to closed
Your need to confirm your account before you can post a new comment.

Sign up or log in to comment