# How can I use the models provided in huggingface.co/models?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352%3E%5C
**Category:** Beginners\
**Created:** [April 7, 2021, 7:07pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352 "2021-04-07T19:07:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farazk86](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/farazk86/32/922_2.png) [@farazk86](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffarazk86)%5C
**Post date:** [April 7, 2021, 7:07pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352%2F1 "2021-04-07T19:07:42Z")

</div>

Hi,

How can I use the models provided in [Hugging Face – The AI community building the future.](https://huggingface.co/models)? For example, if I want to generate the same output as in the example for the hosted interface API for [roberta-large-mnli · Hugging Face](https://huggingface.co/roberta-large-mnli), how would I get the same result for a text I input?

I see that this is written in “use in transformers”:

```
from transformers import AutoTokenizer, AutoModelForSequenceClassification
  
tokenizer = AutoTokenizer.from_pretrained("roberta-large-mnli")

model = AutoModelForSequenceClassification.from_pretrained("roberta-large-mnli")

```

But I dont know how to apply the downloaded model to my own text?

I’ve tried given this to `pipeline`, `classifier = pipeline('roberta-large-mnli')` but its not a recognized model.

Any help here would be appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flewtun)%5C
**Post date:** [April 8, 2021, 12:32pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352%2F2 "2021-04-08T12:32:10Z")

</div>

hey @farazk86, you almost had it right with the `pipeline` - as described in the [docs](https://huggingface.co/transformers/main_classes/pipelines.html?highlight=pipelines#transformers.pipeline), you also need to provide the `task` with the model. in this case we’re dealing with text classification (entailment), so we can use the `sentiment-analysis` task as follows:

```auto
from transformers import pipeline

pipe = pipeline(task="sentiment-analysis", model="roberta-large-mnli")
pipe("I like you. </s></s> I love you.") # returns [{'label': 'NEUTRAL', 'score': 0.5168218612670898}]

```

If you want to see how to generate the predictions using the tokenizer and model directly, I suggest checking out the MNLI task in this tutorial: [https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/text\_classification.ipynb](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/text_classification.ipynb)

---

<div class="post-metadata">

**Author:** ![farazk86](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/farazk86/32/922_2.png) [@farazk86](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffarazk86)%5C
**Post date:** [April 9, 2021, 9:26am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352%2F3 "2021-04-09T09:26:16Z")

</div>

Thanks for the reply @lewtun this allowed me to use `pipeline` with this model but it is not generating the predictions or labels as is shown on the demo or hosted page. There, on the same input of `I like you. </s></s> I love you.` It produces the following outputs:

```
CONTRADICTION

NEUTRAL

ENTAILMENT

```

with:

```
pipe = pipeline(task="sentiment-analysis", model="roberta-large-mnli")
pipe("I like you. </s></s> I love you.")

```

I am only getting the `NEUTRAL` output.

How do I get the same outputs as on the hosted API?

Thanks

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flewtun)%5C
**Post date:** [April 9, 2021, 9:32am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-use-the-models-provided-in-huggingface-co-models%2F5352%2F4 "2021-04-09T09:32:18Z")

</div>

you can get all the scores by passing `return_all_scores=True` to the pipeline as follows:

```auto
pipe = pipeline(task="sentiment-analysis", model="roberta-large-mnli", return_all_scores=True)

```

hth!
