Update README.md
Browse files
README.md
CHANGED
@@ -3,17 +3,18 @@ library_name: transformers
|
|
3 |
tags: []
|
4 |
---
|
5 |
```python
|
6 |
-
from transformers import MambaConfig, MambaForCausalLM, AutoTokenizer
|
7 |
-
import torch
|
8 |
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b", padding_side = "left")
|
10 |
-
tokenizer.pad_token = tokenizer.eos_token
|
11 |
|
12 |
-
model = MambaForCausalLM.from_pretrained("state-spaces/mamba-130m", vocab_size=50280, num_hidden_layers=24, torch_dtype=torch.float32)
|
13 |
-
model.config.use_cache = True
|
14 |
-
input_ids = tokenizer(["Hey how are you doing?", "Explain how soy sauce is made"], padding=True, return_tensors= "pt")["input_ids"]
|
15 |
|
16 |
-
out = model.generate(input_ids, max_new_tokens=10)
|
17 |
-
print(tokenizer.batch_decode(out))
|
|
|
18 |
```
|
19 |
|
|
|
3 |
tags: []
|
4 |
---
|
5 |
```python
|
6 |
+
>>> from transformers import MambaConfig, MambaForCausalLM, AutoTokenizer
|
7 |
+
>>> import torch
|
8 |
|
9 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b", padding_side = "left")
|
10 |
+
>>> tokenizer.pad_token = tokenizer.eos_token
|
11 |
|
12 |
+
>>> model = MambaForCausalLM.from_pretrained("state-spaces/mamba-130m", vocab_size=50280, num_hidden_layers=24, torch_dtype=torch.float32)
|
13 |
+
>>> model.config.use_cache = True
|
14 |
+
>>> input_ids = tokenizer(["Hey how are you doing?", "Explain how soy sauce is made"], padding=True, return_tensors= "pt")["input_ids"]
|
15 |
|
16 |
+
>>> out = model.generate(input_ids, max_new_tokens=10)
|
17 |
+
>>> print(tokenizer.batch_decode(out))
|
18 |
+
["<|endoftext|>Hey how are you doing?\n\nI'm a newbie to the game", 'Explain how soy sauce is made.\n\n1. Add the soy sauce to']
|
19 |
```
|
20 |
|