ivanzhouyq
commited on
Commit
•
f97a1de
1
Parent(s):
fb88855
Add readme
Browse files
README.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Levanter Backpacks
|
2 |
+
|
3 |
+
Example:
|
4 |
+
|
5 |
+
```
|
6 |
+
import torch
|
7 |
+
import transformers
|
8 |
+
from transformers import AutoModelForCausalLM
|
9 |
+
|
10 |
+
|
11 |
+
model_id = "ivanzhouyq/levanter-backpacks"
|
12 |
+
config = transformers.AutoConfig.from_pretrained(model_id, trust_remote_code=True)
|
13 |
+
torch_model = AutoModelForCausalLM.from_pretrained(model_id, config=config, trust_remote_code=True)
|
14 |
+
torch_model.eval()
|
15 |
+
|
16 |
+
input = torch.randint(0, 50264, (1, 512), dtype=torch.long)
|
17 |
+
torch_out = torch_model(
|
18 |
+
input,
|
19 |
+
position_ids=None,
|
20 |
+
)
|
21 |
+
torch_out = torch.nn.functional.softmax(torch_out.logits, dim=-1)
|
22 |
+
```
|