Text Generation
Transformers
Safetensors
English
fwkv
feature-extraction
rnn
conversational
custom_code
Instructions to use FWKV/Fables with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FWKV/Fables with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FWKV/Fables", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FWKV/Fables", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FWKV/Fables with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FWKV/Fables" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FWKV/Fables", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FWKV/Fables
- SGLang
How to use FWKV/Fables 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 "FWKV/Fables" \ --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": "FWKV/Fables", "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 "FWKV/Fables" \ --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": "FWKV/Fables", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use FWKV/Fables with Docker Model Runner:
docker model run hf.co/FWKV/Fables
Download configuration_fwkv.py from FWKV/Fables: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/FWKV/Fables/resolve/main/configuration_fwkv.py
- Command line
-
hf download hf://FWKV/Fables/configuration_fwkv.py
-
curl -L -o configuration_fwkv.py https://huggingface.co/FWKV/Fables/resolve/main/configuration_fwkv.py
1.24 kB
| from transformers import PretrainedConfig | |
| class FWKVConfig(PretrainedConfig): | |
| model_type = "fwkv" | |
| def __init__( | |
| self, | |
| vocab_size=50257, | |
| d_model=768, | |
| d_emb=384, | |
| n_layers=13, | |
| ffn_mult=4, | |
| head_size=64, | |
| wkv_floor=0.1, | |
| wkv_ceil=0.999, | |
| tau_min=2.0, | |
| tau_max=1000.0, | |
| seq_len=1024, | |
| ce_chunk=512, | |
| arch_version=2, | |
| tie_word_embeddings=True, | |
| **kwargs, | |
| ): | |
| super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs) | |
| self.vocab_size = vocab_size | |
| self.d_model = d_model | |
| self.d_emb = d_emb | |
| self.n_layers = n_layers | |
| self.ffn_mult = ffn_mult | |
| self.head_size = head_size | |
| self.wkv_floor = wkv_floor | |
| self.wkv_ceil = wkv_ceil | |
| self.tau_min = tau_min | |
| self.tau_max = tau_max | |
| self.seq_len = seq_len | |
| self.ce_chunk = ce_chunk | |
| self.arch_version = arch_version | |
| # ─── Standard HF aliases ─── | |
| self.num_hidden_layers = n_layers | |
| self.hidden_size = d_model | |
| self.num_attention_heads = 1 # dummy, not used by FWKV | |
| self.num_key_value_heads = 1 # dummy |