Jayveersinh-Raj
commited on
Commit
•
40d0174
1
Parent(s):
ea38c42
Updated
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Model discription
|
2 |
+
Hindi Summarization model. It summarizes a hindi paragraph.
|
3 |
+
|
4 |
+
# Base model
|
5 |
+
- mt5-small
|
6 |
+
|
7 |
+
# How to use
|
8 |
+
|
9 |
+
from transformers import AutoTokenizer
|
10 |
+
from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
|
11 |
+
|
12 |
+
checkpoint = "Jayveersinh-Raj/hindi-summarizer-small"
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
14 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
|
15 |
+
|
16 |
+
# Input paragraph for summarization
|
17 |
+
input_sentence = "<sum> your hindi paragraph"
|
18 |
+
|
19 |
+
# Tokenize the input sentence
|
20 |
+
input_ids = tokenizer.encode(input_sentence, return_tensors="pt").to("cuda")
|
21 |
+
|
22 |
+
# Generate predictions
|
23 |
+
with torch.no_grad():
|
24 |
+
output_ids = model.generate(input_ids, max_new_tokens=200)
|
25 |
+
|
26 |
+
# Decode the generated output
|
27 |
+
output_sentence = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
28 |
+
|
29 |
+
# Print the generated output
|
30 |
+
print("Input:", input_sentence)
|
31 |
+
print("Summarized:", output_sentence)
|
32 |
+
|
33 |
+
# Evaluation
|
34 |
+
- Rogue1: 0.38
|
35 |
+
- BLUE: 0.35
|