Vijayendra commited on
Commit
3949246
·
verified ·
1 Parent(s): cb5b4d0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -0
README.md CHANGED
@@ -6,3 +6,33 @@ base_model:
6
  - google-t5/t5-base
7
  ---
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - google-t5/t5-base
7
  ---
8
 
9
+
10
+ ## How to Get Started with the Model
11
+
12
+ Use the code below to get started with the model.
13
+
14
+
15
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
16
+
17
+ # Load the model and tokenizer from your Hugging Face repository
18
+ model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
19
+ tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
20
+
21
+ # Example of using the model for summarization
22
+ article = """
23
+ The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring
24
+ 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the
25
+ world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300
26
+ metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft).
27
+ Excluding transmitters, it is the second tallest free-standing structure in France after the Millau Viaduct.
28
+ """
29
+ inputs = tokenizer.encode("summarize: " + article, return_tensors="pt", max_length=512, truncation=True)
30
+ summary_ids = model.generate(inputs, max_length=150, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
31
+
32
+ # Decode and print the summary
33
+ summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
34
+ print(summary)
35
+
36
+
37
+ [More Information Needed]
38
+