How can I use the models provided in huggingface.co/models?
Hi,How can I use the models provided inHugging Face – The AI community building the future.? For example, if I want to generate the same output as in the example for the hosted interface API forroberta-large-mnli · Hugging Face, 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 topipeline,classifier = pipeline('roberta-large-mnli')but its not a recognized model.Any help here would be appreciated.Thanks
2021-04-08T12:32:10Z
hey@farazk86, you almost had it right with thepipeline- as described in thedocs, you also need to provide thetaskwith the model. in this case we’re dealing with text classification (entailment), so we can use thesentiment-analysistask as follows: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
2021-04-09T09:26:16Z
Thanks for the reply@lewtunthis allowed me to usepipelinewith 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 ofI like you. </s></s> I love you.It produces the following outputs:CONTRADICTION

NEUTRAL

ENTAILMENTwith:pipe = pipeline(task="sentiment-analysis", model="roberta-large-mnli")
pipe("I like you. </s></s> I love you.")I am only getting theNEUTRALoutput.How do I get the same outputs as on the hosted API?Thanks
2021-04-09T09:32:18Z
you can get all the scores by passingreturn_all_scores=Trueto the pipeline as follows:pipe = pipeline(task="sentiment-analysis", model="roberta-large-mnli", return_all_scores=True)hth!