# Multiple Categories (labels)

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%3E%5C
**Category:** Beginners\
**Created:** [June 18, 2021, 12:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961 "2021-06-18T12:27:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowdere](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/snowdere/32/1819_2.png) [@snowdere](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsnowdere)%5C
**Post date:** [June 18, 2021, 12:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%2F1 "2021-06-18T12:27:12Z")

</div>

Hi @joeddav and @bhadresh-savani I am using your text-classification models, but I am encountering a problem, nothing I try allows me to retrieve all the values: always just the first value is returned, would you be able to advise me, thanks so much.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/c/c5bfcfdb185bf8ce5b19f2a634d85ebff379f83b.png)

> **[joeddav/distilbert-base-uncased-go-emotions-student · Hugging Face](https://huggingface.co/joeddav/distilbert-base-uncased-go-emotions-student)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[bhadresh-savani/distilbert-base-uncased-emotion · Hugging Face](https://huggingface.co/bhadresh-savani/distilbert-base-uncased-emotion)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![bhadresh-savani](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bhadresh-savani/32/30594_2.png) [@bhadresh-savani](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbhadresh-savani)%5C
**Post date:** [June 18, 2021, 12:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%2F2 "2021-06-18T12:58:58Z")

</div>

Hi @snowdere,  
I am really glad you use this model, you can use it like either of the below ways

```python
from transformers import pipeline
classifier = pipeline("text-classification",model='bhadresh-savani/distilbert-base-uncased-emotion', return_all_scores=True)
prediction = classifier("I love using transformers. The best part is wide range of support and its easy to use", )
print(prediction)

```

or

```auto
from transformers import pipeline
classifier = pipeline("sentiment-analysis",model='bhadresh-savani/distilbert-base-uncased-emotion', return_all_scores=True)
prediction = classifier("I love using transformers. The best part is wide range of support and its easy to use", )
print(prediction)

```

`return_all_scores=True` should be in the `pipeline()` argument.  
Output:

```json
[[
{'label': 'sadness', 'score': 0.0006792712374590337}, 
{'label': 'joy', 'score': 0.9959300756454468}, 
{'label': 'love', 'score': 0.0009452480007894337}, 
{'label': 'anger', 'score': 0.0018055217806249857}, 
{'label': 'fear', 'score': 0.00041110432357527316}, 
{'label': 'surprise', 'score': 0.0002288572577526793}
]]

```

Thanks

---

<div class="post-metadata">

**Author:** ![snowdere](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/snowdere/32/1819_2.png) [@snowdere](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsnowdere)%5C
**Post date:** [June 21, 2021, 8:23am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%2F3 "2021-06-21T08:23:42Z")

</div>

> [@bhadresh-savani](#):
>
> ```auto
> from transformers import pipeline
> classifier = pipeline("text-classification",model='bhadresh-savani/distilbert-base-uncased-emotion', return_all_scores=True)
> prediction = classifier("I love using transformers. The best part is wide range of support and its easy to use", )
> print(prediction)
> 
> ```

Thanks for the answer that is great, so can this also be used for multiclassification (if it is both for example joy and love?) i.e. 60% joy, and 70% love and 20% anger etc…if not, do you know what model I can use for this?

---

<div class="post-metadata">

**Author:** ![bhadresh-savani](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bhadresh-savani/32/30594_2.png) [@bhadresh-savani](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbhadresh-savani)%5C
**Post date:** [June 21, 2021, 9:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%2F4 "2021-06-21T09:52:38Z")

</div>

Hi @snowdere,  
Currently, `text-classification` pipeline only has multiclass classification. It uses softmax if more than two labels. You can try zero-shot pipeline, it supports multilabel things that you required. This model I trained for multiclass classification as the emotion dataset is multiclass kind of dataset(i.e. having labels like [1 0 0 0 0 0] with six class).

---

<div class="post-metadata">

**Author:** ![ernests](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@ernests](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fernests)%5C
**Post date:** [February 1, 2023, 10:31am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmultiple-categories-labels%2F6961%2F5 "2023-02-01T10:31:56Z")

</div>

`return_all_scores` has been Deprecated. Instead pass `top_k=None` if you want all scores.
