cpv2280 commited on
Commit
c9ca991
·
verified ·
1 Parent(s): 8dec076

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +124 -0
README.md CHANGED
@@ -12,3 +12,127 @@ short_description: Gradio
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
15
+
16
+ GPT-2 Fine-Tuned TinyStories Project - FableWeaver AI
17
+
18
+ Overview
19
+
20
+ This project fine-tunes a GPT-2 model on the TinyStories dataset to generate structured, coherent, and engaging short narratives. The model is hosted on Hugging Face Spaces and provides a user-friendly interface for story generation.
21
+
22
+ Features
23
+
24
+ Story Generation: Produces coherent, child-friendly short stories.
25
+
26
+ Bias Monitoring: Ensures balanced gender and cultural representation.
27
+
28
+ Efficient Training: Fine-tuned on 200,000 training samples and 20,000 test samples.
29
+
30
+ Grammar & Readability Improvements: Integrated grammar-checking tools and text refinement.
31
+
32
+ Optimized Model Performance: Uses loss tracking, sampling techniques, and bias mitigation strategies.
33
+
34
+ System Architecture
35
+
36
+ The model is designed for easy interaction via Hugging Face Spaces and follows this pipeline:
37
+
38
+ Data Preprocessing & Cleaning
39
+
40
+ Tokenization, formatting, and encoding normalization.
41
+
42
+ Bias mitigation and balanced data preparation.
43
+
44
+ Model Fine-Tuning
45
+
46
+ Fine-tuned GPT-2 (124M parameters) using Hugging Face Transformers.
47
+
48
+ Hyperparameter optimization (batch size, learning rate, weight decay).
49
+
50
+ Story Generation Pipeline
51
+
52
+ Uses top-k filtering (k=50), top-p nucleus sampling (p=0.9), and temperature adjustments.
53
+
54
+ Post-Processing & Bias Mitigation
55
+
56
+ Contextual reinforcement and diversity-aware storytelling.
57
+
58
+ No-repeat n-gram settings and logical scene transitions.
59
+
60
+ Evaluation & Performance Monitoring
61
+
62
+ Tracked using Weights & Biases (W&B) and TensorBoard.
63
+
64
+ Analyzed validation loss and coherence checks.
65
+
66
+ Getting Started
67
+
68
+ Accessing the Model
69
+
70
+ The model is available on Hugging Face Spaces: GPT-2 TinyStories Generator
71
+
72
+ Usage Instructions
73
+
74
+ Visit the Hugging Face Space linked above.
75
+
76
+ Enter a prompt (e.g., "Once upon a time...") in the input field.
77
+
78
+ Click Generate to receive an AI-generated short story.
79
+
80
+ Modify the prompt and settings (temperature, top-k, top-p) for different results.
81
+
82
+ Training Details
83
+
84
+ Model: GPT-2 (124M)
85
+
86
+ Dataset: RonenEldan/TinyStories
87
+
88
+ Training: 3 epochs on Google Colab GPU (T4)
89
+
90
+ Loss Metrics:
91
+
92
+ Training Loss: 3.08 → 2.86
93
+
94
+ Validation Loss: 1.46 → 1.40
95
+
96
+ Evaluation & Observations
97
+
98
+ Perplexity improved from 8.12 → 2.09, indicating better text fluency.
99
+
100
+ Validation loss decreased consistently, suggesting effective generalization.
101
+
102
+ Human evaluation highlighted minor inconsistencies, such as abrupt scene shifts and simplistic narratives.
103
+
104
+ Ethical Considerations
105
+
106
+ Bias Monitoring: Pronoun analysis and diversity checks to ensure fairness.
107
+
108
+ Harmful Content Mitigation: Manually reviewed outputs for stereotypes.
109
+
110
+ Text Processing Issues: UTF-8 encoding applied to prevent character errors.
111
+
112
+ Future Improvements
113
+
114
+ Enhancing Creativity: Fine-tune temperature and randomness settings.
115
+
116
+ Genre-Specific Training: Introduce theme-based datasets.
117
+
118
+ Larger Model Training: Experiment with GPT-2 (355M) for richer storytelling.
119
+
120
+ Contributors
121
+
122
+ Charla Pia Vella (Project Developer)
123
+
124
+ Affiliation: ARI3333 Generative AI
125
+
126
+ License
127
+
128
+ This project is released under the Apache-2.0 License.
129
+
130
+ Acknowledgments
131
+
132
+ OpenAI for GPT-2
133
+
134
+ Hugging Face for the fine-tuning framework
135
+
136
+ Ronen Eldan for the TinyStories dataset
137
+
138
+ For more details, visit the Hugging Face Space.