Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- mamba-hf
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Mamba-3B
|
| 10 |
+
|
| 11 |
+
<img src="https://th.bing.com/th/id/OIG.Jp5dA01tOAFcwSp544nv?pid=ImgGn" width="300" height="300" alt="mamba-hf">
|
| 12 |
+
|
| 13 |
+
Mamba Models with hf_integration.
|
| 14 |
+
[**mamba-hf** Github Repo](https://github.com/LegallyCoder/mamba-hf)
|
| 15 |
+
|
| 16 |
+
# Usage:
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from transformers import AutoModelForCausalLM , AutoTokenizer
|
| 20 |
+
|
| 21 |
+
model = AutoModelForCausalLM.from_pretrained('Q-bert/Mamba-3B', trust_remote_code=True)
|
| 22 |
+
tokenizer = AutoTokenizer.from_pretrained('Q-bert/Mamba-3B')
|
| 23 |
+
|
| 24 |
+
text = "Hi"
|
| 25 |
+
|
| 26 |
+
input_ids = tokenizer.encode(text, return_tensors="pt")
|
| 27 |
+
|
| 28 |
+
output = model.generate(input_ids, max_length=20, num_beams=5, no_repeat_ngram_size=2)
|
| 29 |
+
|
| 30 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 31 |
+
|
| 32 |
+
print(generated_text)
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
> Hi, I'm looking for a new job. I've been working at a company for about a year now.
|
| 36 |
+
|
| 37 |
+
# Credits:
|
| 38 |
+
|
| 39 |
+
https://huggingface.co/state-spaces
|
| 40 |
+
|
| 41 |
+
Special thanks to Albert Gu and Tri Dao for their articles. (https://arxiv.org/abs/2312.00752)
|
| 42 |
+
|