Convert Diet classifier model into ONNX format

I am trying to convert the diet classifier model in the rasa pipeline into ONNX format to reduce the model size. However, I am unable to do so and I am running into errors. The major reason for that I assume is the fact that rasa uses eager mode under the hood for diet classifier model but I may be wrong. ONNX conversion requires that we run a forward pass with the model, so that it can trace and record the operations and convert them into ONNX specific ops. However, when I tried to debug DIET classifier in isolation, I found that the actual code is never implemented during training. It rather goes into some temporary python file in /tmp and executes a method called outer_factory(). I am not sure if this is the expected behavior/desgin choice. So is there a way to convert the diet classifier mode to ONNX format within rasa? If not, is there a way to run the forward pass of the model without having rasa integrations and APIs interfering so that I can debug the model for tensor shapes? Any help would be appreciated. Thank you!


@kushalj001 any success ?

Nope. I haven’t worked on this since. They have refactored their code in their latest releases. I am not sure if that will make it work.