Commit
·
c3ef69a
1
Parent(s):
de682e6
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,44 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
pipeline_tag: text-generation
|
3 |
+
tags:
|
4 |
+
- text-generation-inference
|
5 |
+
- backpack
|
6 |
+
- backpackmodel
|
7 |
+
library_name: transformers
|
8 |
license: apache-2.0
|
9 |
+
datasets:
|
10 |
+
- openwebtext
|
11 |
+
language:
|
12 |
+
- en
|
13 |
---
|
14 |
+
|
15 |
+
# How to Get Started with the Model
|
16 |
+
|
17 |
+
Please install `transformers`, `safetensors` and `torch` to use this model.
|
18 |
+
|
19 |
+
```bash
|
20 |
+
pip install transformers safetensors torch
|
21 |
+
```
|
22 |
+
|
23 |
+
Run the following Python code:
|
24 |
+
|
25 |
+
```python
|
26 |
+
import torch
|
27 |
+
import transformers
|
28 |
+
from transformers import AutoModelForCausalLM
|
29 |
+
|
30 |
+
|
31 |
+
model_id = "ivanzhouyq/levanter-backpack-1b-100k"
|
32 |
+
config = transformers.AutoConfig.from_pretrained(model_id, trust_remote_code=True)
|
33 |
+
torch_model = AutoModelForCausalLM.from_pretrained(
|
34 |
+
model_id,
|
35 |
+
config=config,
|
36 |
+
trust_remote_code=True
|
37 |
+
)
|
38 |
+
torch_model.eval()
|
39 |
+
|
40 |
+
input = torch.randint(0, 50264, (1, 512), dtype=torch.long)
|
41 |
+
torch_out = torch_model(input, position_ids=None,)
|
42 |
+
torch_out = torch.nn.functional.softmax(torch_out.logits, dim=-1)
|
43 |
+
print(torch_out.shape)
|
44 |
+
```
|