Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1 |
-
---
|
2 |
-
license: llama2
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama2
|
3 |
+
language:
|
4 |
+
- fa
|
5 |
+
---
|
6 |
+
Base Model:
|
7 |
+
https://huggingface.co/mostafaamiri/persian_llama_7B_merged
|
8 |
+
|
9 |
+
---
|
10 |
+
Model fine-tuned on a real news dataset and optimized for neural news generation.
|
11 |
+
|
12 |
+
Note: Turkish was not in pretraining.
|
13 |
+
|
14 |
+
```python
|
15 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
|
16 |
+
|
17 |
+
# Load model and tokenizer
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained('bigscience/bloomz')
|
19 |
+
model = AutoModelForSequenceClassification.from_pretrained('tum-nlp/neural-news-generator-llama-7b-fa')
|
20 |
+
|
21 |
+
# Create the pipeline for neural news generation and set the repetition penalty >1.1 to punish repetition.
|
22 |
+
generator = pipeline('text-generation',
|
23 |
+
model=model,
|
24 |
+
tokenizer=tokenizer,
|
25 |
+
repetition_penalty=1.2)
|
26 |
+
|
27 |
+
# Define the prompt
|
28 |
+
prompt = " [EOP] به دنبال «شورش مسلحانه» مزدوران نظامی واگنر و تصرف برخی "
|
29 |
+
|
30 |
+
# Generate
|
31 |
+
generator(prompt, max_length=1000, num_return_sequences=1)
|
32 |
+
|
33 |
+
```
|
34 |
+
|
35 |
+
Trained on 6k datapoints (including all splits) from:
|
36 |
+
https://huggingface.co/datasets/RohanAiLab/persian_news_dataset
|