File size: 588 Bytes
cdf1100
 
 
 
b3c3a84
cdf1100
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "nm-testing/TinyLlama-1.1B-Chat-v1.0-pruned50-24"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(model_id)
inputs = tokenizer("Hello my name is", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.batch_decode(outputs)[0])
"""
<s> Hello my name is John. I am a student at the University of the University of the University of the University of the

"""
```