From the course: Applied AI: Getting Started with Hugging Face Transformers

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Using a custom model

Using a custom model

- [Instructor] In the previous example, we used the default model for sentiment pipeline to predict sentiment. The pipeline module also allows us to use a custom model in place of the default one. To find an alternate sentiment model, let's go to the hugging face website to the model's page. Let's search for text classification models that has the name sentiment in it. We will pick the sentiment model that starts with bertweet. Clicking on the model name takes us to the model card. This model card gives us information about this model. To use this model, we just need to copy the exact name and path. We can do so by clicking the copy to clipboard button. Back to the notebook. To use the custom model, we will call the pipeline with an explicit model parameter. We specify the model name copied from the website here. We then call the sentiment classifier. Since it's a new model, the pipeline module will download this…

Contents