Commit
·
20ece27
1
Parent(s):
3b54ba5
Update README.md
Browse files
README.md
CHANGED
@@ -55,10 +55,17 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
55 |
To generate text, use the following Python code:
|
56 |
|
57 |
```python
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
```
|
63 |
|
64 |
|
|
|
55 |
To generate text, use the following Python code:
|
56 |
|
57 |
```python
|
58 |
+
messages=[
|
59 |
+
{ 'role': 'user', 'content': prompt}
|
60 |
+
]
|
61 |
+
|
62 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
63 |
+
|
64 |
+
# 32021 is the id of <|EOT|> token
|
65 |
+
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=32021)
|
66 |
+
|
67 |
+
print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
|
68 |
+
|
69 |
```
|
70 |
|
71 |
|