Update README.md
Browse files
README.md
CHANGED
|
@@ -21,12 +21,12 @@ import torch
|
|
| 21 |
from transformers import pipeline, AutoTokenizer
|
| 22 |
|
| 23 |
question = "Write a Python function that takes a list of numbers and returns the list sorted in ascending order without using the built-in `sorted()` function."
|
| 24 |
-
generator = pipeline("text-generation", model="mariasandu/python-coding-assistant-v2", device="
|
| 25 |
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained("mariasandu/python-coding-assistant-v2")
|
| 27 |
tokenizer.chat_template = "{% for message in messages %}{% if message['role'] == 'user' %}[INST] {{ message['content'] }} [/INST]{% else %}{{ message['content'] }}{% endif %}{% endfor %}"
|
| 28 |
-
output = generator(question)
|
| 29 |
-
print(output[
|
| 30 |
```
|
| 31 |
|
| 32 |
## Training procedure
|
|
|
|
| 21 |
from transformers import pipeline, AutoTokenizer
|
| 22 |
|
| 23 |
question = "Write a Python function that takes a list of numbers and returns the list sorted in ascending order without using the built-in `sorted()` function."
|
| 24 |
+
generator = pipeline("text-generation", model="mariasandu/python-coding-assistant-v2", device="cuda")
|
| 25 |
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained("mariasandu/python-coding-assistant-v2")
|
| 27 |
tokenizer.chat_template = "{% for message in messages %}{% if message['role'] == 'user' %}[INST] {{ message['content'] }} [/INST]{% else %}{{ message['content'] }}{% endif %}{% endfor %}"
|
| 28 |
+
output = generator(question)[0]
|
| 29 |
+
print(output['generated_text'])
|
| 30 |
```
|
| 31 |
|
| 32 |
## Training procedure
|