kunaltilaganji commited on
Commit
4e77052
·
1 Parent(s): 0beba1e

Create ReadME

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pretraining-BERT-with-Hugging-Face-Transformers
2
+
3
+ # Introduction
4
+
5
+ Automatic summarization is a central problem in Natural Language Processing (NLP). It involves challenges related to language understanding and generation. This tutorial focuses on abstractive summarization, aiming to generate concise, abstractive summaries of news articles.
6
+
7
+ We tackle this task using the [Text-to-Text Transfer Transformer (T5)](https://arxiv.org/abs/1910.10683), a Transformer-based model pretrained on various text-to-text tasks. T5's encoder-decoder architecture has shown impressive results in sequence-to-sequence tasks like summarization and translation.
8
+
9
+ In this notebook, I fine-tune pretrained T5 on the Abstractive Summarization task using Hugging Face Transformers and the `XSum` dataset.
10
+
11
+ ## Setup
12
+
13
+ Install the required libraries:
14
+
15
+ ```bash
16
+ pip install transformers==4.20.0
17
+ pip install keras_nlp==0.3.0
18
+ pip install datasets
19
+ pip install huggingface-hub
20
+ pip install nltk
21
+ pip install rouge-score
22
+ ```
23
+
24
+ ## Loading the Dataset
25
+
26
+ We download the [Extreme Summarization (XSum)](https://arxiv.org/abs/1808.08745) dataset, consisting of BBC articles and single-sentence summaries. The dataset is divided into training, validation, and test sets. We use the ROUGE metric for evaluation.
27
+
28
+ We use the [Hugging Face Datasets](https://github.com/huggingface/datasets) library to easily load the data with `load_dataset`.
29
+
30
+ ## Data Pre-processing
31
+
32
+ Before feeding texts to the model, we pre-process them using Hugging Face Transformers' `Tokenizer`. It tokenizes inputs, converts tokens to IDs in the pretrained vocabulary, and generates model-ready inputs.
33
+
34
+ ```python
35
+ from transformers import T5Tokenizer
36
+ tokenizer = T5Tokenizer.from_pretrained(MODEL_CHECKPOINT)
37
+ ```
38
+
39
+ ## Inference
40
+
41
+ We use the `summarization` pipeline from Hugging Face Transformers to infer the trained model's summary for arbitrary articles.
42
+
43
+ ```python
44
+ from transformers import pipeline
45
+ summarizer = pipeline("summarization", model=model, tokenizer=tokenizer, framework="tf")
46
+ summary = summarizer(article)
47
+ ```
48
+ Feel free to use this README as a template for your GitHub repository and customize it with additional details, instructions, and explanations.
49
+
50
+ <b>Please replace the placeholders like `MODEL_CHECKPOINT` with actual values and adjust any other details to match your repository's content.</b>
51
+
52
+
53
+ ## Acknowledgments
54
+ This project was inspired by the research papers [Text-to-Text Transfer Transformer (T5)](https://arxiv.org/abs/1910.10683).
55
+
56
+
57
+ ## Contact
58
+
59
+ For questions or feedback, please feel free to reach out:
60
+
61
+ - Author: Kunal Tilaganji
62
+
63
+ Project Link: [Link](https://github.com/kunaltilaganji/Abstractive-Summarization-with-Hugging-Face-Transformers)