Vijayendra commited on
Commit
128a110
·
verified ·
1 Parent(s): 9caddb7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -27
README.md CHANGED
@@ -9,44 +9,29 @@ datasets:
9
  metrics:
10
  - rouge
11
  ---
 
12
 
13
- ---
14
- ## How to Get Started with the Model
15
 
16
- Use the code below to get started with the model.
17
 
 
18
 
 
19
  from transformers import T5ForConditionalGeneration, T5Tokenizer
20
 
21
- # Load the model and tokenizer from Hugging Face repository
22
-
23
  model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
24
  tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
25
 
26
- # Example of a random article (can replace this with any article)
27
-
28
- random_article = """
29
- Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said. The policy includes the
30
- termination of accounts of anti-vaccine influencers. Tech giants have been criticised for not doing more to counter false health information on their sites. In July, US President
31
- Joe Biden said social media platforms were largely responsible for people's scepticism in getting vaccinated by spreading misinformation, and appealed for them to address the
32
- issue. YouTube, which is owned by Google, said 130,000 videos were removed from its platform since last year, when it implemented a ban on content spreading misinformation
33
- about Covid vaccines. In a blog post, the company said it had seen false claims about Covid jabs "spill over into misinformation about vaccines in general". The new policy
34
- covers long-approved vaccines, such as those against measles or hepatitis B. "We're expanding our medical misinformation policies on YouTube with new guidelines on currently
35
- administered vaccines that are approved and confirmed to be safe and effective by local health authorities and the WHO," the post said, referring to the World Health Organization.
36
  """
37
-
38
- # Tokenize the input article
39
-
40
- inputs = tokenizer.encode("summarize: " + random_article, return_tensors="pt", max_length=512, truncation=True)
41
-
42
- # Generate summary
43
-
44
- summary_ids = model.generate(inputs, max_length=150, min_length=100, length_penalty=3.0, num_beams=7, early_stopping=False)
45
 
46
  # Decode and print the summary
47
-
48
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
49
- print("Summary:")
50
  print(summary)
51
- ---
52
- [More Information Needed]
 
9
  metrics:
10
  - rouge
11
  ---
12
+ # T5-Base-Sum
13
 
14
+ This model is a fine-tuned version of `T5` for summarization tasks. It was trained on various articles and is hosted on Hugging Face for easy access and use.
 
15
 
16
+ ## Model Usage
17
 
18
+ Below is an example of how to load and use this model for summarization:
19
 
20
+ ```python
21
  from transformers import T5ForConditionalGeneration, T5Tokenizer
22
 
23
+ # Load the model and tokenizer from Hugging Face
 
24
  model = T5ForConditionalGeneration.from_pretrained("Vijayendra/T5-Base-Sum")
25
  tokenizer = T5Tokenizer.from_pretrained("Vijayendra/T5-Base-Sum")
26
 
27
+ # Example of using the model for summarization
28
+ article = """
29
+ Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said. The policy includes the
30
+ termination of accounts of anti-vaccine influencers.
 
 
 
 
 
 
31
  """
32
+ inputs = tokenizer.encode("summarize: " + article, return_tensors="pt", max_length=512, truncation=True)
33
+ summary_ids = model.generate(inputs, max_length=150, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
 
 
 
 
 
 
34
 
35
  # Decode and print the summary
 
36
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
 
37
  print(summary)