From the course: Deep Learning with Python: Sequence Models and Transformers
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Topic classification with pretrained models in Python - Python Tutorial
From the course: Deep Learning with Python: Sequence Models and Transformers
Topic classification with pretrained models in Python
- [Instructor] In this example, we're going to use a pre-trained model from the Hugging Face hub for topic classification. Topic classification is a technique used to assign predefined topics or categories such as weather, sports, finance and more to a given piece of text. Let's start by selecting a kernel. Then we minimize or reduce the verbosity of our logs. So now, we're ready to instantiate a pipeline for topic classification. So the Hugging Face hub does not have a dedicated pipeline named for topic classification. However, we can still use generic text classification pipeline for this purpose. But for this to occur, we would need to use a model specifically trained for topic classification. In this example, we're going to use the multilingual-IPTC-news-topic-classifier. To use this model, we begin by importing the pipeline function from the transformers package. We specify the name of our model and that we instantiate a new pipeline called topics. Within the pipeline function…
Contents
-
-
-
-
-
- (Locked) Named entity recognition with pretrained models in Python4m 57s
- (Locked) Part-of-speech tagging with pretrained models in Python2m 43s
- (Locked) Sentiment analysis with pretrained models in Python4m 47s
- (Locked) Topic classification with pretrained models in Python3m 35s
- (Locked) Text summarization with pretrained models in Python5m 11s
- (Locked) Question answering with pretrained models in Python3m 23s
- (Locked)
-