mwitiderrick
commited on
Commit
•
2c347a5
1
Parent(s):
36c7d4e
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```python
|
2 |
+
import torch
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
4 |
+
|
5 |
+
model_id = "/home/mwiti/mwitiderrick/output_oneshot"
|
6 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
8 |
+
inputs = tokenizer("Hello my name is", return_tensors="pt")
|
9 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
10 |
+
print(tokenizer.batch_decode(outputs)[0])
|
11 |
+
|
12 |
+
"""
|
13 |
+
<s> Hello my name is Katie and I am a student at the University of Gloucestershire. I am currently studying
|
14 |
+
|
15 |
+
"""
|
16 |
+
|
17 |
+
|
18 |
+
```
|