ayjays132 commited on
Commit
ab20b0f
1 Parent(s): 0417d9a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -5
README.md CHANGED
@@ -7,30 +7,67 @@ library_name: transformers
7
 
8
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
 
 
 
 
 
 
 
11
 
 
 
 
12
  from transformers import BartTokenizer, BartForConditionalGeneration
13
  from datasets import load_dataset
14
 
15
- # Load pre-trained BART model for summarization
16
  tokenizer = BartTokenizer.from_pretrained('ayjays132/EnhancerModel')
17
  model = BartForConditionalGeneration.from_pretrained('ayjays132/EnhancerModel')
18
 
19
- # Load dataset
20
  dataset = load_dataset("cnn_dailymail", "3.0.0")
21
 
22
- # Function to generate summary
23
  def summarize(text):
24
  inputs = tokenizer(text, return_tensors="pt", max_length=1024, truncation=True)
25
  summary_ids = model.generate(inputs['input_ids'], max_length=150, min_length=40, length_penalty=2.0, num_beams=4, early_stopping=True)
26
  return tokenizer.decode(summary_ids[0], skip_special_tokens=True)
27
 
28
- # Debugging: Print the type and content of the first example
29
  print("Type of dataset['test']:", type(dataset['test']))
30
  print("Type of the first element in dataset['test']:", type(dataset['test'][0]))
31
  print("Content of the first element in dataset['test']:", dataset['test'][0])
32
 
33
- # Test the model on a few examples
34
  for example in dataset['test'][:5]:
35
  try:
36
  # If the example is a string, then it's likely that 'dataset['test']' is not loaded as expected
@@ -47,3 +84,5 @@ for example in dataset['test'][:5]:
47
  print("No 'article' field found in this example.")
48
  except Exception as e:
49
  print(f"Error processing example: {e}")
 
 
 
7
 
8
 
9
 
10
+ <style>
11
+ body {
12
+ font-family: Arial, sans-serif;
13
+ line-height: 1.6;
14
+ margin: 0;
15
+ padding: 20px;
16
+ background-color: #f4f4f4;
17
+ }
18
+ .model-description {
19
+ background: #fff;
20
+ border-radius: 8px;
21
+ padding: 20px;
22
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
23
+ max-width: 800px;
24
+ margin: auto;
25
+ }
26
+ .model-description h2 {
27
+ margin-top: 0;
28
+ color: #333;
29
+ }
30
+ .model-description p {
31
+ margin: 0 0 10px;
32
+ color: #666;
33
+ }
34
+ </style>
35
+ </head>
36
+ <body>
37
 
38
+ <div class="model-description">
39
+ <h2>Enhanced Model Features</h2>
40
+ <p><strong>Adaptability:</strong> Adjusts to diverse contexts and user needs, ensuring relevant and precise interactions.</p>
41
+ <p><strong>Contextual Intelligence:</strong> Provides contextually aware responses, improving engagement and interaction quality.</p>
42
+ <p><strong>Advanced Algorithms:</strong> Employs cutting-edge algorithms for sophisticated and intelligent responses.</p>
43
+ <p><strong>User Experience:</strong> Designed with a focus on seamless interaction, offering an intuitive and refined user experience.</p>
44
+ </div>
45
 
46
+
47
+ <div class="code-container">
48
+ <code>
49
  from transformers import BartTokenizer, BartForConditionalGeneration
50
  from datasets import load_dataset
51
 
52
+ Load pre-trained BART model for summarization
53
  tokenizer = BartTokenizer.from_pretrained('ayjays132/EnhancerModel')
54
  model = BartForConditionalGeneration.from_pretrained('ayjays132/EnhancerModel')
55
 
56
+ Load dataset
57
  dataset = load_dataset("cnn_dailymail", "3.0.0")
58
 
59
+ Function to generate summary
60
  def summarize(text):
61
  inputs = tokenizer(text, return_tensors="pt", max_length=1024, truncation=True)
62
  summary_ids = model.generate(inputs['input_ids'], max_length=150, min_length=40, length_penalty=2.0, num_beams=4, early_stopping=True)
63
  return tokenizer.decode(summary_ids[0], skip_special_tokens=True)
64
 
65
+ ebugging: Print the type and content of the first example
66
  print("Type of dataset['test']:", type(dataset['test']))
67
  print("Type of the first element in dataset['test']:", type(dataset['test'][0]))
68
  print("Content of the first element in dataset['test']:", dataset['test'][0])
69
 
70
+ Test the model on a few examples
71
  for example in dataset['test'][:5]:
72
  try:
73
  # If the example is a string, then it's likely that 'dataset['test']' is not loaded as expected
 
84
  print("No 'article' field found in this example.")
85
  except Exception as e:
86
  print(f"Error processing example: {e}")
87
+ </code>
88
+ </div>