# New pipeline for zero-shot text classification

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-pipeline-for-zero-shot-text-classification%2F681%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 11, 2020, 6:34pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-pipeline-for-zero-shot-text-classification%2F681 "2020-08-11T18:34:22Z")\
**Posts on this page:** 1\
**Showing post:** 67

<div class="post-metadata">

**Author:** ![joeddav](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/joeddav/32/53881_2.png) [@joeddav](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjoeddav)%5C
**Post date:** [December 15, 2020, 2:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-pipeline-for-zero-shot-text-classification%2F681%2F67 "2020-12-15T14:37:17Z")

</div>

Hey @charly, here’s a [previous thread](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fway-to-make-inference-zero-shot-pipeline-faster%2F1384%2F2) about that. The main tricks are going to be:

- Use one of these [distilled models](https://huggingface.co/models?filter=distilbart-mnli) which are smaller and faster but with similar results
- Run with the ONNX Runtime. One way you can do this is with [this project](https://github.com/patil-suraj/onnx_transformers) created by @valhalla before he joined Hugging Face
- If you have long sequences you’re classifying, you can try truncating to just part of the sequence. That’ll give you a speedup but you’ll have to evaluate how it impacts your performance.
- If you have a large # of candidate labels, try to come up with a heuristic or use a super lightweight classifier to identify the most likely candidates, and then just feed in those more likely candidates rather than all of them.

Btw if it’s public would you mind linking to your streamlit app? It’s always fun to see the ways that people are using it 😊

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-pipeline-for-zero-shot-text-classification%2F681)._
