File size: 620 Bytes
190f34c
 
4d25b91
 
190f34c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
license: apache-2.0
language:
- en
---

```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

device = 'cuda' if torch.cuda.is_available() else 'cpu'

model = AutoModelForCausalLM.from_pretrained('simpx/noob', trust_remote_code=True)
model = model.to(device)
model.eval()
tokenizer = AutoTokenizer.from_pretrained('simpx/noob', trust_remote_code=True)

context = torch.zeros((1, 1), dtype=torch.long, device=device)

with torch.no_grad():
    output_ids = model.generate(context, max_new_tokens=100)[0].tolist()
    output_text = tokenizer.decode(output_ids)
    print(output_text)
```