Instructions to use RWKV/rwkv-5-world-3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RWKV/rwkv-5-world-3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RWKV/rwkv-5-world-3b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("RWKV/rwkv-5-world-3b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RWKV/rwkv-5-world-3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RWKV/rwkv-5-world-3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV/rwkv-5-world-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RWKV/rwkv-5-world-3b
- SGLang
How to use RWKV/rwkv-5-world-3b 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/rwkv-5-world-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV/rwkv-5-world-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/rwkv-5-world-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RWKV/rwkv-5-world-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RWKV/rwkv-5-world-3b with Docker Model Runner:
docker model run hf.co/RWKV/rwkv-5-world-3b
Exception in autotrain-advanced
I tried to fine tune the model with autotrain advanced, I got this exception:
File "/home/knut/transformers/lib/python3.9/site-packages/autotrain/utils.py", line 280, in wrapper
return func(*args, **kwargs)
File "/home/knut/transformers/lib/python3.9/site-packages/autotrain/trainers/clm/main.py", line 197, in train
model.resize_token_embeddings(len(tokenizer))
File "/home/knut/transformers/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1563, in resize_token_embeddings
model_embeds = self._resize_token_embeddings(new_num_tokens, pad_to_multiple_of)
File "/home/knut/transformers/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1577, in _resize_token_embeddings
old_embeddings = self.get_input_embeddings()
File "/home/knut/transformers/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1354, in get_input_embeddings
raise NotImplementedError
NotImplementedError
Got an idea what's going on here?