PatrickHaller
commited on
Commit
•
4ab617a
1
Parent(s):
6a3cfd7
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license: mit
|
5 |
+
---
|
6 |
+
|
7 |
+
# An xLSTM Model
|
8 |
+
|
9 |
+
Trained with [Helibrunna](https://github.com/PatrickHaller/helibrunna) (fork)
|
10 |
+
|
11 |
+
To use this model the [xLSTM](https://github.com/NX-AI/xlstm) package is required. We recommend to install
|
12 |
+
it locally with conda:
|
13 |
+
|
14 |
+
```bash
|
15 |
+
git clone https://github.com/NX-AI/xlstm
|
16 |
+
cd xlstm
|
17 |
+
conda env create -n xlstm -f environment_pt220cu121.yaml
|
18 |
+
conda activate xlstm
|
19 |
+
```
|
20 |
+
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoModelForCasualLM, AutoTokenizer
|
26 |
+
|
27 |
+
model_name_or_path = "PatrickHaller/xlstm_dummy"
|
28 |
+
|
29 |
+
model = AutoModelForCasualLM.from_pretrained(model_name_or_path)
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
31 |
+
|
32 |
+
input_ids = tokenizer.encode("Hello, my dog is cute", return_tensors="pt")
|
33 |
+
output = model.generate(input_ids, max_length=100, temperature=0.7, do_sample=True)
|
34 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
35 |
+
|
36 |
+
print(generated_text)
|
37 |
+
|
38 |
+
```
|