Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
```python
|
6 |
+
import torch
|
7 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
+
|
9 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
10 |
+
|
11 |
+
model = AutoModelForCausalLM.from_pretrained('simpx/noob', trust_remote_code=True)
|
12 |
+
model = model.to(device)
|
13 |
+
model.eval()
|
14 |
+
tokenizer = AutoTokenizer.from_pretrained('simpx/noob', trust_remote_code=True)
|
15 |
+
|
16 |
+
context = torch.zeros((1, 1), dtype=torch.long, device=device)
|
17 |
+
|
18 |
+
with torch.no_grad():
|
19 |
+
output_ids = model.generate(context, max_new_tokens=100)[0].tolist()
|
20 |
+
output_text = tokenizer.decode(output_ids)
|
21 |
+
print(output_text)
|
22 |
+
```
|