Update README.md
Browse files
README.md
CHANGED
@@ -24,157 +24,85 @@ quantization:
|
|
24 |
bnb_4bit_compute_dtype: float16
|
25 |
bnb_4bit_use_double_quant: true
|
26 |
---
|
|
|
27 |
# Model Card for llama_poetry_fa
|
28 |
|
29 |
**Model Name:** llama_poetry_fa
|
30 |
-
**Model URL:** https://huggingface.co/8lianno/llama_poetry_fa
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
|
36 |
## Model Details
|
37 |
|
38 |
### Model Description
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
- **Funded by [optional]:** {{ funded_by | default("[More Information Needed]", true)}}
|
44 |
-
- **Shared by [optional]:** {{ shared_by | default("[More Information Needed]", true)}}
|
45 |
-
- **Model type:** {{ model_type | default("Causal Language Model (Llama-based)", true)}}
|
46 |
-
- **Language(s) (NLP):** {{ language | default("fa", true)}}
|
47 |
-
- **License:** {{ license | default("[More Information Needed]", true)}}
|
48 |
-
- **Finetuned from model [optional]:** {{ base_model | default("meta-llama/Llama-3.1-8B-Instruct", true)}}
|
49 |
|
50 |
-
### Model Sources
|
51 |
|
52 |
-
- **Repository:**
|
53 |
-
- **Paper [optional]:**
|
54 |
-
- **Demo [optional]:**
|
55 |
|
56 |
## Uses
|
57 |
|
58 |
### Direct Use
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
### Downstream Use
|
63 |
|
64 |
-
|
|
|
|
|
|
|
65 |
|
66 |
### Out-of-Scope Use
|
67 |
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
## Bias, Risks, and Limitations
|
71 |
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
### Recommendations
|
75 |
|
76 |
-
|
|
|
|
|
77 |
|
78 |
## How to Get Started with the Model
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
## Training Details
|
83 |
-
|
84 |
-
### Training Data
|
85 |
-
|
86 |
-
{{ training_data | default("The model was trained on a collection of Persian poetry and literature. More details needed.", true)}}
|
87 |
-
|
88 |
-
### Training Procedure
|
89 |
-
|
90 |
-
#### Preprocessing [optional]
|
91 |
-
|
92 |
-
{{ preprocessing | default("[More Information Needed]", true)}}
|
93 |
-
|
94 |
-
#### Training Hyperparameters
|
95 |
-
|
96 |
-
- **Training regime:** {{ training_regime | default("Fine-tuned with LoRA and 4-bit quantization.", true)}}
|
97 |
-
|
98 |
-
#### Speeds, Sizes, Times [optional]
|
99 |
-
|
100 |
-
{{ speeds_sizes_times | default("[More Information Needed]", true)}}
|
101 |
-
|
102 |
-
## Evaluation
|
103 |
-
|
104 |
-
### Testing Data, Factors & Metrics
|
105 |
-
|
106 |
-
#### Testing Data
|
107 |
-
|
108 |
-
{{ testing_data | default("Internal Persian poetry test samples.", true)}}
|
109 |
-
|
110 |
-
#### Factors
|
111 |
-
|
112 |
-
{{ testing_factors | default("[More Information Needed]", true)}}
|
113 |
-
|
114 |
-
#### Metrics
|
115 |
-
|
116 |
-
{{ testing_metrics | default("[More Information Needed]", true)}}
|
117 |
-
|
118 |
-
### Results
|
119 |
-
|
120 |
-
{{ results | default("[More Information Needed]", true)}}
|
121 |
-
|
122 |
-
#### Summary
|
123 |
-
|
124 |
-
{{ results_summary | default("", true) }}
|
125 |
-
|
126 |
-
## Model Examination [optional]
|
127 |
-
|
128 |
-
{{ model_examination | default("[More Information Needed]", true)}}
|
129 |
-
|
130 |
-
## Environmental Impact
|
131 |
-
|
132 |
-
- **Hardware Type:** {{ hardware_type | default("[More Information Needed]", true)}}
|
133 |
-
- **Hours used:** {{ hours_used | default("[More Information Needed]", true)}}
|
134 |
-
- **Cloud Provider:** {{ cloud_provider | default("[More Information Needed]", true)}}
|
135 |
-
- **Compute Region:** {{ cloud_region | default("[More Information Needed]", true)}}
|
136 |
-
- **Carbon Emitted:** {{ co2_emitted | default("[More Information Needed]", true)}}
|
137 |
-
|
138 |
-
## Technical Specifications [optional]
|
139 |
-
|
140 |
-
### Model Architecture and Objective
|
141 |
-
|
142 |
-
{{ model_specs | default("Llama-based causal language model fine-tuned for Persian poetry.", true)}}
|
143 |
-
|
144 |
-
### Compute Infrastructure
|
145 |
-
|
146 |
-
{{ compute_infrastructure | default("[More Information Needed]", true)}}
|
147 |
-
|
148 |
-
#### Hardware
|
149 |
-
|
150 |
-
{{ hardware_requirements | default("[More Information Needed]", true)}}
|
151 |
-
|
152 |
-
#### Software
|
153 |
-
|
154 |
-
{{ software | default("[More Information Needed]", true)}}
|
155 |
-
|
156 |
-
## Citation [optional]
|
157 |
-
|
158 |
-
**BibTeX:**
|
159 |
-
|
160 |
-
{{ citation_bibtex | default("[More Information Needed]", true)}}
|
161 |
-
|
162 |
-
**APA:**
|
163 |
-
|
164 |
-
{{ citation_apa | default("[More Information Needed]", true)}}
|
165 |
-
|
166 |
-
## Glossary [optional]
|
167 |
-
|
168 |
-
{{ glossary | default("[More Information Needed]", true)}}
|
169 |
-
|
170 |
-
## More Information [optional]
|
171 |
-
|
172 |
-
{{ more_information | default("[More Information Needed]", true)}}
|
173 |
-
|
174 |
-
## Model Card Authors [optional]
|
175 |
|
176 |
-
|
|
|
177 |
|
178 |
-
|
|
|
|
|
|
|
179 |
|
180 |
-
|
|
|
|
|
|
24 |
bnb_4bit_compute_dtype: float16
|
25 |
bnb_4bit_use_double_quant: true
|
26 |
---
|
27 |
+
|
28 |
# Model Card for llama_poetry_fa
|
29 |
|
30 |
**Model Name:** llama_poetry_fa
|
31 |
+
**Model URL:** [https://huggingface.co/8lianno/llama_poetry_fa](https://huggingface.co/8lianno/llama_poetry_fa)
|
32 |
|
33 |
+
## Model Summary
|
34 |
|
35 |
+
`llama_poetry_fa` is a Persian poetry generation model fine-tuned from a Llama 3.1-based checkpoint. It aims to produce stylistically coherent, culturally relevant, and metrically sound verses in response to a user’s prompt. The model focuses on generating output that aligns with classical Persian poetic traditions, such as maintaining consistent rhyme schemes and thematic unity.
|
36 |
|
37 |
## Model Details
|
38 |
|
39 |
### Model Description
|
40 |
|
41 |
+
- **Developed by:** 8lianno
|
42 |
+
- **Model type:** Causal Language Model (Llama-based, instruction-tuned)
|
43 |
+
- **Language:** Persian (fa)
|
44 |
+
- **License:** *[More Information Needed]*
|
45 |
+
- **Finetuned from:** `meta-llama/Llama-3.1-8B-Instruct`
|
46 |
|
47 |
+
This model has been trained to understand Persian poetic structure, using additional tokens `[شروع_شعر]`, `[پایان_شعر]`, and `[مصرع]` to guide and maintain poem formatting. It can respond to various thematic prompts—whether about nature, love, historical figures, or abstract concepts—and produce a poem that attempts to follow Persian poetry norms.
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
### Model Sources
|
50 |
|
51 |
+
- **Repository:** [https://huggingface.co/8lianno/llama_poetry_fa](https://huggingface.co/8lianno/llama_poetry_fa)
|
52 |
+
- **Paper [optional]:** No formal paper at this time.
|
53 |
+
- **Demo [optional]:** Future demonstration pages may be provided.
|
54 |
|
55 |
## Uses
|
56 |
|
57 |
### Direct Use
|
58 |
|
59 |
+
This model is intended to generate Persian poetry in response to user prompts. It can be used as a creative writing aid, a tool for literary exploration, or as a source of inspiration for authors, poets, and students studying Persian literature.
|
60 |
+
|
61 |
+
**Example:**
|
62 |
+
- **Prompt:** "درباره بهار شعری بسرایید"
|
63 |
+
- **Response:** A poem about spring, attempting to maintain poetic structure and rhyme.
|
64 |
|
65 |
+
### Downstream Use
|
66 |
|
67 |
+
While primarily designed for poetry generation, the model can be integrated into:
|
68 |
+
- Persian literature chatbots
|
69 |
+
- Educational applications for Persian poetry studies
|
70 |
+
- Cultural or literary heritage projects
|
71 |
|
72 |
### Out-of-Scope Use
|
73 |
|
74 |
+
The model is not designed for:
|
75 |
+
- Factual Question-Answering (it may produce poetic but factually incorrect answers)
|
76 |
+
- Non-Persian text generation
|
77 |
+
- High-stakes decision making
|
78 |
|
79 |
## Bias, Risks, and Limitations
|
80 |
|
81 |
+
The model’s content is drawn from its training data and may reflect certain cultural or poetic biases. It might:
|
82 |
+
- Present thematically repetitive motifs or styles from classical Persian poetry.
|
83 |
+
- Struggle with modern or colloquial Persian forms.
|
84 |
+
- Occasionally produce incoherent or repetitive verses.
|
85 |
+
|
86 |
+
Users should critically evaluate the generated text, especially if used in academic or public-facing contexts.
|
87 |
|
88 |
### Recommendations
|
89 |
|
90 |
+
- Review generated poems for cultural appropriateness.
|
91 |
+
- Verify factual accuracy independently.
|
92 |
+
- For sensitive or controversial topics, consider human moderation.
|
93 |
|
94 |
## How to Get Started with the Model
|
95 |
|
96 |
+
Use the provided `poetry_generator.py` script:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
```python
|
99 |
+
from poetry_generator import PoetryGenerator
|
100 |
|
101 |
+
generator = PoetryGenerator(
|
102 |
+
model_path="/path/to/your/trained/model",
|
103 |
+
token="your_hf_token"
|
104 |
+
)
|
105 |
|
106 |
+
prompt = "امید چیست؟"
|
107 |
+
poem = generator.generate_poem(prompt)
|
108 |
+
print(poem)
|