Update README.md
Browse files
README.md
CHANGED
@@ -23,6 +23,18 @@ Fine-tuned model of Arabic poetry dataset based on aragpt2-medium.
|
|
23 |
#### How to use
|
24 |
|
25 |
Try this [HF Space](https://huggingface.co/spaces/akhooli/poetry).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
#### Limitations and bias
|
28 |
|
|
|
23 |
#### How to use
|
24 |
|
25 |
Try this [HF Space](https://huggingface.co/spaces/akhooli/poetry).
|
26 |
+
From script:
|
27 |
+
`
|
28 |
+
from transformers import pipeline
|
29 |
+
pipe = pipeline('text-generation', framework='pt', device=-1, model='akhooli/ap2023', tokenizer='akhooli/ap2023')
|
30 |
+
gen = pipe(prompt, max_length=96, temperature = 0.95,repetition_penalty=1.05,
|
31 |
+
num_beams=3, num_return_sequences=2, do_sample = True,
|
32 |
+
top_p = 1.0, top_k = 50, return_full_text=True)[0]["generated_text"]
|
33 |
+
poetry =""
|
34 |
+
for line in gen.split('.')[:-1]:
|
35 |
+
poetry += line
|
36 |
+
print(poetry)
|
37 |
+
`
|
38 |
|
39 |
#### Limitations and bias
|
40 |
|