Update README.md
Browse files
README.md
CHANGED
|
@@ -11,7 +11,8 @@ from transformers import AutoTokenizer
|
|
| 11 |
import transformers
|
| 12 |
import torch
|
| 13 |
model = "Zen1t/WordWeaver-AI"
|
| 14 |
-
prompt = "
|
|
|
|
| 15 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 16 |
pipeline = transformers.pipeline(
|
| 17 |
"text-generation",
|
|
@@ -20,7 +21,7 @@ pipeline = transformers.pipeline(
|
|
| 20 |
device_map="auto",
|
| 21 |
)
|
| 22 |
sequences = pipeline(
|
| 23 |
-
|
| 24 |
do_sample=True,
|
| 25 |
top_k=10,
|
| 26 |
num_return_sequences=1,
|
|
@@ -28,14 +29,10 @@ sequences = pipeline(
|
|
| 28 |
max_length=200,
|
| 29 |
)
|
| 30 |
for seq in sequences:
|
| 31 |
-
print(
|
| 32 |
```
|
| 33 |
|
| 34 |
**Output**
|
| 35 |
```
|
| 36 |
-
|
| 37 |
-
As an artist, Leonardo da Vinci painted beautiful paintings using his skills and knowledge. Some of his most famous paintings are:
|
| 38 |
-
* The Mona Lisa: a painting of a woman who is smiling mysteriously, and is considered one of the greatest works of art of the Renaissance.
|
| 39 |
-
* The Last Supper: a mural painting depicting the last meal Jesus shared with his twelve disciples before he died.
|
| 40 |
-
* The Virgin and Child with St. Anne and St. John the
|
| 41 |
```
|
|
|
|
| 11 |
import transformers
|
| 12 |
import torch
|
| 13 |
model = "Zen1t/WordWeaver-AI"
|
| 14 |
+
prompt = "Сегодня он собирался удивить Аню сюрпризом — отвезти её в ресторан, заслуживающий особого внимания из-за своего расположения. А располагался тот на двадцать пятом этаже здания «Российской Академии Наук». Из его окон, судя по описанию, открывался изумительный вид на город, особенно ночью."
|
| 15 |
+
prompt = f"<s>[INST] {prompt} [/INST]"
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 17 |
pipeline = transformers.pipeline(
|
| 18 |
"text-generation",
|
|
|
|
| 21 |
device_map="auto",
|
| 22 |
)
|
| 23 |
sequences = pipeline(
|
| 24 |
+
prompt,
|
| 25 |
do_sample=True,
|
| 26 |
top_k=10,
|
| 27 |
num_return_sequences=1,
|
|
|
|
| 29 |
max_length=200,
|
| 30 |
)
|
| 31 |
for seq in sequences:
|
| 32 |
+
print(seq['generated_text'][len(prompt):])
|
| 33 |
```
|
| 34 |
|
| 35 |
**Output**
|
| 36 |
```
|
| 37 |
+
Сегодня он собирался удивить Аню сюрпризом — отвезти ее в ресторан, заслуживающий особого внимания из-за своего расположения на двадцать пятом этаже здания «Российской Академии Наук». Из его окон, судя по описанию, открывался изумительный вид на город, особенно ночью.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
```
|