-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ONNX Support #8638
Comments
As of now, ONNX is a talking point used by large companies, that doesn't seem to address an existing problem and doesn't seem to have actual users. This may change in the future, but this is the current situation. Keras takes a very programatic approach to development, implementing features that match user needs rather than abstract PR-driven strategies. If ONNX becomes significant in the future, we will add support for it. But while its purpose it to serve as a corporate PR talking point, we will not invest development efforts into it. I encourage you to look at NNEF and OpenVX. Should Keras support them? Why? Why not? Is ONNX more relevant than these? I would also point out that there is an existing NN exchange format that works across TF, CNTK, Theano, browsers, the JVM, and even MXNet to an extent: Keras savefiles. Importantly, Keras savefiles already have lots of users. |
Now that we have this, https://cloudblogs.microsoft.com/opensource/2020/01/21/microsoft-onnx-open-source-optimizations-transformer-inference-gpu-cpu/ Can we reopen this issue? |
Is there any documentation on how to use Keras savefiles in the latest version of Keras? |
I think reopening the issue might be the right choice! |
cc @sachinprasadhs |
@innat can you say more about what you had in mind? Something that goes directly And how would that compare to going to onnx through a backend? E.g. set the torch bachend, use torch onnx tools to export to onnx? |
Sounds good. Here is jax2xla, a numpy backedn onnx interpreter, google/jaxonnxruntime.
I think this suits more. However,
|
Thanks all for the inputs. I think the most approvable way to do this so far is either using TF savedmodel to ONNX, or torch backend (less mature on Keras side) to ONNX. For any Keras model, user probably can take following workflow:
Since Keras is a high level framework, we could also choose to directly export ONNX, but this will take signaficant effort to implement all the ops mapping, and I think leverage TF to ONNX is probably the most low cost approach at this moment. Keras side probably should provide a guide/example for how to do this. I believe this feature will be important since it opens up the way to user to leverage more downstream system like Nvidia TensorRT for inference, etc. @fchollet for more inputs. |
Discussed this in the team meeting. In general we will leverage each backend for their own way to export to ONNX, eg TF has its own way to convert tf savedmodel to ONNX, same for JAX and pytorch. Keras will not support direct export to ONNX at this stage (eg implement ONNX ops set). We will provide documentation, and potential APIs to support user to convert to ONNX. |
Adding Neel since this is related to saving/exporting. |
Hi, any movement on this? |
Hi, I would like to contribute towards this. From what I understood from this issue, the idea is to use each backend's existing onnx conversion method (at least for now). |
Yes, exactly. Each backend can use its own mechanism for ONNX conversion. The public API would be via |
Hi there.
I see no discussions about ONNX, an open source framework to share models among different deep learning libraries. I don't know if this is better implemented at the Keras level or at the backend level (CNTK already supports it), but I think it's worth discussing!
The text was updated successfully, but these errors were encountered: