Instructions to use RWKV-Red-Team/ARWKV-7B-Preview-0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RWKV-Red-Team/ARWKV-7B-Preview-0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RWKV-Red-Team/ARWKV-7B-Preview-0.1", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("RWKV-Red-Team/ARWKV-7B-Preview-0.1", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RWKV-Red-Team/ARWKV-7B-Preview-0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RWKV-Red-Team/ARWKV-7B-Preview-0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV-Red-Team/ARWKV-7B-Preview-0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RWKV-Red-Team/ARWKV-7B-Preview-0.1
- SGLang
How to use RWKV-Red-Team/ARWKV-7B-Preview-0.1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RWKV-Red-Team/ARWKV-7B-Preview-0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV-Red-Team/ARWKV-7B-Preview-0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RWKV-Red-Team/ARWKV-7B-Preview-0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV-Red-Team/ARWKV-7B-Preview-0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RWKV-Red-Team/ARWKV-7B-Preview-0.1 with Docker Model Runner:
docker model run hf.co/RWKV-Red-Team/ARWKV-7B-Preview-0.1
Update wkv.py
Browse files
wkv.py
CHANGED
|
@@ -282,7 +282,7 @@ class Rwkv_Tmix_x070(nn.Module):
|
|
| 282 |
self.a0 + (xa @ self.a1) @ self.a2
|
| 283 |
) # a is "in-context learning rate"
|
| 284 |
if self.args.wkv_has_gate:
|
| 285 |
-
g = torch.sigmoid(xg @ self.g1) @ self.g2 + 1.0
|
| 286 |
kk = k * self.k_k
|
| 287 |
kk = F.normalize(kk.view(B, T, self.n_head, -1),
|
| 288 |
p=2.0, dim=-1, eps=1e-4 if kk.dtype == torch.float16 else 1e-12).view(B, T, C)
|
|
|
|
| 282 |
self.a0 + (xa @ self.a1) @ self.a2
|
| 283 |
) # a is "in-context learning rate"
|
| 284 |
if self.args.wkv_has_gate:
|
| 285 |
+
g = torch.sigmoid(xg @ self.g1) @ self.g2 #+ 1.0
|
| 286 |
kk = k * self.k_k
|
| 287 |
kk = F.normalize(kk.view(B, T, self.n_head, -1),
|
| 288 |
p=2.0, dim=-1, eps=1e-4 if kk.dtype == torch.float16 else 1e-12).view(B, T, C)
|