Text-Classification Pipeline - Newbie question

Hello huggingface community. I am wondering if I did understand the pipeline text-classification correctly. Is it the case, that the model I choose defines the task I can do with it and the output I will get? I was a bit confused, because I used pipeline(“sentiment-analysis”) but did not find “sentiment-analysis” as a model or option setting. And VSCode autocomplete also did not suggest it, but it still works. So I came to the conclusion I laid out before. Is this correct or am I wrong. Thanks and may you all have a good time.

1 Like

Hi Markus,

“sentiment-analysis” is the task specifying what you want a large language model to perform on the text. Sentiment analysis practically changes the model’s head to a classifier, which you can see here:

This pipeline is pre-configured, the settings can be found below in the same file defined here:

2 Likes

Thank you. So it is generally an alias for text-classification. I was confused because it did not show up as a separate pipeline in chapter 1 of the LLM course on huggingface. But now I understand why. Appreciate your support and the quick answer.

2 Likes

That’s right – “sentiment-analysis” practically does sequence classification (there are also other types of classification tasks possible, for example token classification, just fyi) under the hood in the linear output layer of the LLM. Please also see the docstring for the TextClassificationPipeline here:

3 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.