Upload folder using huggingface_hub
Browse files- README.md +12 -10
- model.safetensors +2 -2
README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- zh
|
|
@@ -9,10 +10,9 @@ language:
|
|
| 9 |
- ar
|
| 10 |
- es
|
| 11 |
- pt
|
|
|
|
| 12 |
metrics:
|
| 13 |
- accuracy
|
| 14 |
-
base_model:
|
| 15 |
-
- BlinkDL/rwkv-7-world
|
| 16 |
pipeline_tag: text-generation
|
| 17 |
library_name: transformers
|
| 18 |
---
|
|
@@ -44,15 +44,15 @@ This is RWKV-7 model under flash-linear attention format.
|
|
| 44 |
<!-- Provide the basic links for the model. -->
|
| 45 |
|
| 46 |
- **Repository:** https://github.com/fla-org/flash-linear-attention ; https://github.com/BlinkDL/RWKV-LM
|
| 47 |
-
- **Paper:**
|
| 48 |
|
| 49 |
## Uses
|
| 50 |
|
| 51 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 52 |
-
Install `flash-linear-attention`
|
| 53 |
|
| 54 |
```bash
|
| 55 |
-
pip install
|
| 56 |
pip install 'transformers>=4.48.0'
|
| 57 |
```
|
| 58 |
|
|
@@ -64,11 +64,9 @@ You can use this model just as any other HuggingFace models:
|
|
| 64 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
model = AutoModelForCausalLM.from_pretrained('fla-hub/rwkv7-191M-world', trust_remote_code=True)
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained('fla-hub/rwkv7-191M-world', trust_remote_code=True)
|
| 67 |
-
model = model.cuda()
|
| 68 |
prompt = "What is a large language model?"
|
| 69 |
messages = [
|
| 70 |
-
{"role": "user", "content": "Who are you?"},
|
| 71 |
-
{"role": "assistant", "content": "I am a GPT-3 based model."},
|
| 72 |
{"role": "user", "content": prompt}
|
| 73 |
]
|
| 74 |
text = tokenizer.apply_chat_template(
|
|
@@ -81,7 +79,11 @@ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
|
| 81 |
|
| 82 |
generated_ids = model.generate(
|
| 83 |
**model_inputs,
|
| 84 |
-
max_new_tokens=
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
)
|
| 86 |
generated_ids = [
|
| 87 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- BlinkDL/rwkv-7-world
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
- zh
|
|
|
|
| 10 |
- ar
|
| 11 |
- es
|
| 12 |
- pt
|
| 13 |
+
license: apache-2.0
|
| 14 |
metrics:
|
| 15 |
- accuracy
|
|
|
|
|
|
|
| 16 |
pipeline_tag: text-generation
|
| 17 |
library_name: transformers
|
| 18 |
---
|
|
|
|
| 44 |
<!-- Provide the basic links for the model. -->
|
| 45 |
|
| 46 |
- **Repository:** https://github.com/fla-org/flash-linear-attention ; https://github.com/BlinkDL/RWKV-LM
|
| 47 |
+
- **Paper:** https://arxiv.org/abs/2503.14456
|
| 48 |
|
| 49 |
## Uses
|
| 50 |
|
| 51 |
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 52 |
+
Install `flash-linear-attention` and the latest version of `transformers` before using this model:
|
| 53 |
|
| 54 |
```bash
|
| 55 |
+
pip install git+https://github.com/fla-org/flash-linear-attention
|
| 56 |
pip install 'transformers>=4.48.0'
|
| 57 |
```
|
| 58 |
|
|
|
|
| 64 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
model = AutoModelForCausalLM.from_pretrained('fla-hub/rwkv7-191M-world', trust_remote_code=True)
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained('fla-hub/rwkv7-191M-world', trust_remote_code=True)
|
| 67 |
+
model = model.cuda() # Supported on Nvidia/AMD/Intel eg. model.xpu()
|
| 68 |
prompt = "What is a large language model?"
|
| 69 |
messages = [
|
|
|
|
|
|
|
| 70 |
{"role": "user", "content": prompt}
|
| 71 |
]
|
| 72 |
text = tokenizer.apply_chat_template(
|
|
|
|
| 79 |
|
| 80 |
generated_ids = model.generate(
|
| 81 |
**model_inputs,
|
| 82 |
+
max_new_tokens=4096,
|
| 83 |
+
do_sample=True,
|
| 84 |
+
temperature=1.0,
|
| 85 |
+
top_p=0.3,
|
| 86 |
+
repetition_penalty=1.2
|
| 87 |
)
|
| 88 |
generated_ids = [
|
| 89 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b96a8bdc21e15f71e0c95653dcc3be89e564b619ad5073c9edbfbd07f7849453
|
| 3 |
+
size 382111072
|