Tasfiya025 commited on
Commit
d56cf8a
·
verified ·
1 Parent(s): 3fd0bdf

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -0
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PoeticTextGenerator_GPT2
2
+
3
+ ## 🖋️ Overview
4
+
5
+ This model is a **GPT-2 Small** variant fine-tuned specifically for the task of **unconditional and conditional poetic text generation**. It has been trained on a curated corpus of classical and contemporary English poetry, allowing it to generate text that mimics meter, rhyme, and figurative language patterns. The model is configured as a `GPT2LMHeadModel` for Language Modeling.
6
+
7
+ ## 🧠 Model Architecture
8
+
9
+ The model leverages the powerful transformer architecture of the GPT-2 Small base model.
10
+
11
+ * **Base Model:** `gpt2` (124M parameters)
12
+ * **Task:** Causal Language Modeling (`GPT2LMHeadModel`)
13
+ * **Tokenization:** Standard GPT-2 Byte Pair Encoding (BPE) tokenizer.
14
+ * **Training Data:** Approximately 20,000 poems spanning multiple centuries and styles (e.g., sonnets, free verse, haikus).
15
+ * **Hyperparameters:** Fine-tuned with a low learning rate to preserve the linguistic capabilities of the base model while acquiring poetic style.
16
+ * **Key Config:** `do_sample=True` and `temperature=0.8` are set as default generation parameters to encourage creative and diverse outputs.
17
+
18
+
19
+ ## 💡 Intended Use
20
+
21
+ * **Creative Writing Assistance:** Providing prompts, completing stanzas, or generating entire poems for writers.
22
+ * **Artistic Installations:** Generating dynamic, ever-changing poetic text for digital art or interactive projects.
23
+ * **Stylometric Research:** Studying the model's ability to imitate different poetic styles by adjusting the prompt or conditioning data.
24
+ * **Educational Tool:** Demonstrating the capabilities of large language models in creative domains.
25
+
26
+ ### How to use
27
+
28
+ ```python
29
+ from transformers import pipeline, set_seed
30
+
31
+ generator = pipeline(
32
+ "text-generation",
33
+ model="[YOUR_HF_USERNAME]/PoeticTextGenerator_GPT2"
34
+ )
35
+ set_seed(42)
36
+
37
+ # Conditional Generation (Prompting a theme)
38
+ prompt = "The shadow of the moon fell upon the silent street,"
39
+ output = generator(
40
+ prompt,
41
+ max_length=50,
42
+ num_return_sequences=1,
43
+ temperature=0.9,
44
+ top_p=0.95,
45
+ do_sample=True
46
+ )
47
+ print(output[0]['generated_text'])
48
+
49
+ # Unconditional Generation (Starting from a single word)
50
+ # output = generator("A", max_length=100, num_return_sequences=1)