agentlans commited on
Commit
561556a
·
verified ·
1 Parent(s): ee4f324

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -3
README.md CHANGED
@@ -1,3 +1,114 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - flan-t5
5
+ - text-to-text
6
+ - title-generation
7
+ license: apache-2.0
8
+ datasets:
9
+ - agentlans/wikipedia-paragraph-titles
10
+ ---
11
+ # Flan-T5 Small Title Generator
12
+
13
+ ## Model Description
14
+
15
+ This model is a fine-tuned version of the Flan-T5 small model, specifically adapted for generating attention-grabbing titles based on given text. Flan-T5 is an improved version of the T5 (Text-To-Text Transfer Transformer) model developed by Google, which has been instruction-tuned on a diverse set of tasks.
16
+
17
+ - **Architecture**: Flan-T5 small
18
+ - **Purpose**: Generate engaging titles from input text
19
+ - **Base Model**: [google/flan-t5-small](https://huggingface.co/google/flan-t5-small)
20
+
21
+ Flan-T5 is an enhanced version of T5, fine-tuned on over 1 000 additional tasks across multiple languages. This makes it better at a wide range of tasks like reasoning, question answering, and few-shot learning, even compared to much larger models.
22
+
23
+ ## Intended Uses & Limitations
24
+
25
+ ### Intended Uses
26
+ - Generating catchy titles for articles, blog posts, or news stories
27
+ - Summarizing key points of a text passage into a concise headline
28
+ - Assisting content creators in brainstorming title ideas
29
+
30
+ ### Limitations
31
+ - Requires clear context from the input paragraph to generate relevant titles
32
+ - May produce exaggerated or off-topic titles if the context is ambiguous
33
+ - Outputs should always be reviewed by a human before use
34
+ - Not suitable for generating titles for sensitive or critical content without human oversight
35
+
36
+ ## Training Details
37
+
38
+ ### Training Data
39
+ The model was fine-tuned on the "Wikipedia Paragraphs and AI-Generated Titles Dataset" ([agentlans/wikipedia-paragraph-titles](https://huggingface.co/datasets/agentlans/wikipedia-paragraph-titles)), which contains:
40
+ - Pairs of Wikipedia paragraphs and corresponding AI-generated titles
41
+ - A mix of human-written content and machine-generated titles
42
+ - Diverse topics from Wikipedia articles
43
+
44
+ <details>
45
+ <summary>Training details</summary>
46
+
47
+ ### Training Procedure
48
+ - **Base Model**: google/flan-t5-small
49
+ - **Fine-tuning Approach**: Further trained on the title generation task
50
+ - **Input Format**: `topic || text`
51
+ - **Output Format**: Attention-grabbing title based on the input text
52
+
53
+ ### Training Hyperparameters
54
+ - Learning rate: 5e-05
55
+ - Train batch size: 8
56
+ - Eval batch size: 8
57
+ - Seed: 42
58
+ - Optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
59
+ - LR scheduler type: linear
60
+ - Number of epochs: 10.0
61
+
62
+ The model was trained using the following framework versions:
63
+ - Transformers 4.45.1
64
+ - PyTorch 2.4.1+cu121
65
+ - Datasets 3.0.1
66
+ - Tokenizers 0.20.0
67
+ </details>
68
+
69
+ ## Ethical Considerations & Biases
70
+
71
+ - The model may inherit biases present in the Wikipedia content used for training
72
+ - There's a risk of generating sensationalized or misleading titles, especially for ambiguous content
73
+ - Users should be aware of potential biases in title generation, particularly for sensitive topics
74
+ - The model should not be used as the sole source for generating titles in professional or journalistic contexts without human review
75
+
76
+ ## Usage
77
+
78
+ To use the model, follow these steps:
79
+
80
+ 1. Input format: `topic || text`
81
+ 2. The model will generate an attention-grabbing title based on the input text
82
+ 3. Always review the output for relevance and appropriateness
83
+
84
+ ### Example Usage
85
+
86
+ Here's a code example demonstrating how to use the Flan-T5 small model for title generation:
87
+
88
+ ```python
89
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
90
+
91
+ model_name = "agentlans/flan-t5-small-title"
92
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
93
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
94
+
95
+ # Prepare the input text
96
+ topic = "The Serenity of Nature" # a cue to establish context (not necessary but recommended)
97
+ text = "As dawn breaks, the world awakens to a symphony of colors and sounds. The golden rays of sunlight filter through the leaves, casting playful shadows on the forest floor. Birds chirp melodiously, their songs weaving through the crisp morning air, while a gentle breeze rustles the branches overhead. Dew-kissed flowers bloom in vibrant hues, their fragrant scents mingling with the earthy aroma of damp soil. In this tranquil setting, one can’t help but feel a profound sense of peace and connection to the natural world, reminding us of the simple joys that life has to offer."
98
+
99
+ input_text = f"{topic}||{text}"
100
+
101
+ # Tokenize the input
102
+ inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
103
+
104
+ # Generate the title
105
+ outputs = model.generate(**inputs, max_length=30, num_return_sequences=1)
106
+
107
+ # Decode and print the generated title
108
+ generated_title = tokenizer.decode(outputs[0], skip_special_tokens=True)
109
+ print(generated_title) # The Serenity of Nature: A Symbol of Peace and Harmony
110
+ ```
111
+
112
+ ## Licence
113
+
114
+ This model is released under the Apache 2.0 license.