# Integrating Custom Pytorch models to RASA pipeline

**URL:** <https://forum.rasa.com/t/integrating-custom-pytorch-models-to-rasa-pipeline/56819>\
**Category:** Rasa Open Source\
**Created:** [January 10, 2023, 10:56am UTC](https://forum.rasa.com/t/integrating-custom-pytorch-models-to-rasa-pipeline/56819 "2023-01-10T10:56:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Menon](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Anand\_Menon](https://forum.rasa.com/u/Anand_Menon)\
**Post date:** [January 10, 2023, 10:56am UTC](https://forum.rasa.com/t/integrating-custom-pytorch-models-to-rasa-pipeline/56819/1 "2023-01-10T10:56:22Z")

</div>

Hey everyone,

We are working on a chatbot use case in which the data is not so clean and balanced. Our initial attempt was to try out Rasa DIET for NLU and got some decent results but the issue we identified of DIET was with false positive being inferred with very high accuracy we can reduce this by using out\_of\_scope intent to an extend and accuracy issues due to class imbalance. So we then tried out a custom classification model using distilled BERT with tuned class weights and the results were more generalised and better compared to DIET.

Now the scenario is to use our own pytorch based Intent classifier for intent classification and rest of rasa components like entity extraction, tracker and dialogue management with RASA. The rules/story has to work based on the intent identified from the custom model instead of rasa NLU.

Is there any feasible solutions for the same ? Came across an blog post

> **[Enhancing Rasa NLU models with Custom Components](https://medium.com/rasa-blog/enhancing-rasa-nlu-models-with-custom-components-6f54040c4a77)**
>
> We believe that customizing ML models is crucial for building successful AI assistants. The open source Rasa NLU library provides you with…

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 10, 2023, 5:12pm UTC](https://forum.rasa.com/t/integrating-custom-pytorch-models-to-rasa-pipeline/56819/2 "2023-01-10T17:12:21Z")

</div>

Yes, you can create your own intent classifier component. I just posted about this [here](https://forum.rasa.com/t/custom-ner-integration-with-rasa/56816).

---

<div class="post-metadata">

**Author:** ![Anand\_Menon](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@Anand\_Menon](https://forum.rasa.com/u/Anand_Menon)\
**Post date:** [January 12, 2023, 6:59am UTC](https://forum.rasa.com/t/integrating-custom-pytorch-models-to-rasa-pipeline/56819/3 "2023-01-12T06:59:21Z")

</div>

Thanks for the update @stephens
