What is the Summarization in transformers?

This recipe explains what is Summarization in transformers.

Recipe Objective - What is the Summarization in transformers?

Summarization is the task of summarizing a document or article in a shorter text. If you want to fit the model in the summary task, you can use the run_summarization.py script.

Learn How to use XLNet for Text Classification

For more related projects -

/projects/data-science-projects/deep-learning-projects
/projects/data-science-projects/neural-network-projects

Example of using pipelines to do summarization:

# Importing libraries
from transformers import pipeline

# Creating pipeline for summarization
model_summarizer = pipeline("summarization")

# Creating article
article = """Delhi, city and national capital territory, north-central India.
... The city of Delhi actually consists of two components: Old Delhi, in the north,
... the historic city; and New Delhi, in the south, since 1947 the capital of India,
... built in the first part of the 20th century as the capital of British India."""

# Passing article to model
output = model_summarizer(article, max_length = 100 ,min_length=30, do_sample=False)[0]

# Printing summarized article
print('Summarized article : ',output['summary_text'])

Output -
Summarized article :   Old Delhi, in the north, is the historic city; New Delhi is the capital of India . New Delhi was built in the first part of the 20th century as the British capital of British India .

In this way, we can perform summarization in transformers.

What Users are saying..

profile image

Anand Kumpatla

Sr Data Scientist @ Doubleslash Software Solutions Pvt Ltd
linkedin profile url

ProjectPro is a unique platform and helps many people in the industry to solve real-life problems with a step-by-step walkthrough of projects. A platform with some fantastic resources to gain... Read More

Relevant Projects

MLOps AWS Project on Topic Modeling using Gunicorn Flask
In this project we will see the end-to-end machine learning development process to design, build and manage reproducible, testable, and evolvable machine learning models by using AWS

NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

MLOps Project to Deploy Resume Parser Model on Paperspace
In this MLOps project, you will learn how to deploy a Resume Parser Streamlit Application on Paperspace Private Cloud.

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

Build Regression (Linear,Ridge,Lasso) Models in NumPy Python
In this machine learning regression project, you will learn to build NumPy Regression Models (Linear Regression, Ridge Regression, Lasso Regression) from Scratch.

Insurance Pricing Forecast Using XGBoost Regressor
In this project, we are going to talk about insurance forecast by using linear and xgboost regression techniques.

Stock Price Prediction Project using LSTM and RNN
Learn how to predict stock prices using RNN and LSTM models. Understand deep learning concepts and apply them to real-world financial data for accurate forecasting.

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

House Price Prediction Project using Machine Learning in Python
Use the Zillow Zestimate Dataset to build a machine learning model for house price prediction.