# Convert Diet classifier model into ONNX format

**URL:** <https://forum.rasa.com/t/convert-diet-classifier-model-into-onnx-format/40363>\
**Category:** Rasa Open Source\
**Created:** [February 18, 2021, 7:16pm UTC](https://forum.rasa.com/t/convert-diet-classifier-model-into-onnx-format/40363 "2021-02-18T19:16:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kushalj001](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/kushalj001/32/13472_2.png) [@kushalj001](https://forum.rasa.com/u/kushalj001)\
**Post date:** [February 18, 2021, 7:16pm UTC](https://forum.rasa.com/t/convert-diet-classifier-model-into-onnx-format/40363/1 "2021-02-18T19:16:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![gauravgola96](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gauravgola96/32/13968_2.png) [@gauravgola96](https://forum.rasa.com/u/gauravgola96)\
**Post date:** [April 20, 2021, 7:34am UTC](https://forum.rasa.com/t/convert-diet-classifier-model-into-onnx-format/40363/2 "2021-04-20T07:34:06Z")

</div>

@kushalj001 any success ?

---

<div class="post-metadata">

**Author:** ![kushalj001](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/kushalj001/32/13472_2.png) [@kushalj001](https://forum.rasa.com/u/kushalj001)\
**Post date:** [May 3, 2021, 5:11am UTC](https://forum.rasa.com/t/convert-diet-classifier-model-into-onnx-format/40363/3 "2021-05-03T05:11:18Z")

</div>

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.
