mwitiderrick
commited on
Commit
•
cdf1100
1
Parent(s):
5e7e64f
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<s> Hello my name is John. I am a student at the University of the University of the University of the University of the
|
13 |
+
|
14 |
+
"""
|
15 |
+
```
|