Instructions to use recursal/QRWKV7-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use recursal/QRWKV7-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="recursal/QRWKV7-7B-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("recursal/QRWKV7-7B-Instruct", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use recursal/QRWKV7-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "recursal/QRWKV7-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "recursal/QRWKV7-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/recursal/QRWKV7-7B-Instruct
- SGLang
How to use recursal/QRWKV7-7B-Instruct 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 "recursal/QRWKV7-7B-Instruct" \ --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": "recursal/QRWKV7-7B-Instruct", "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 "recursal/QRWKV7-7B-Instruct" \ --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": "recursal/QRWKV7-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use recursal/QRWKV7-7B-Instruct with Docker Model Runner:
docker model run hf.co/recursal/QRWKV7-7B-Instruct
RADLADS: Rapid Attention Distillation to Linear Attention Decoders at Scale
RADLADS (Rapid Attention Distillation to Linear Attention Decoders at Scale) introduces a novel protocol for rapidly converting softmax attention transformers into linear attention decoder models. This highly efficient process requires only 350-700 million tokens of distillation, which is less than 0.005% of the token count used to train the original teacher models.
This repository provides the RADRWKV7Qwen2.5-7B model, a converted version from Qwen2.5. The RADLADS approach maintains quality remarkably close to the original transformer while achieving state-of-the-art downstream performance for linear attention models of their size. It enables significantly faster inference due to its constant-time inference per token.
Paper: RADLADS: Rapid Attention Distillation to Linear Attention Decoders at Scale
GitHub Repository: recursal/RADLADS
✨ Key Highlights
- Efficient & Cost-Effective Conversion: Converts large softmax attention transformers to linear attention models with minimal additional training tokens. Converting a 72B model costs less than $2,000 USD.
- Quality Preservation: Models converted using RADLADS maintain quality remarkably close to the original teacher transformer models.
- State-of-the-Art Performance: These models achieve state-of-the-art downstream performance across standard benchmarks for linear attention models of their size.
- Faster Inference: Leverages linear attention for constant-time inference per token, significantly boosting decoding speed.
- New Architectures: Introduces new RWKV-variant architectures (RAD-RWKV6 and RAD-RWKV7) optimized for linear attention.
How to use
This model is compatible with the Hugging Face transformers library. Ensure trust_remote_code=True is set when loading the model due to custom architecture components.
Text Generation
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "recursal/RADRWKV7Qwen2.5-7B" # This model
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16, # or torch.float16 if needed
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True, use_fast=False)
# Prepare input
text = "The quick brown fox jumps over the lazy"
input_ids = tokenizer.encode(text, return_tensors="pt").to(model.device)
# Generate text
generated_ids = model.generate(
input_ids,
max_new_tokens=50,
do_sample=False, # Set to True for sampling, adjust temperature/top_p
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.eos_token_id, # Or set to a specific pad_token_id if available
)
# Decode output
output_text = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print(f"Input: {text}
Generated: {output_text}")
Citation
If you use this model or find our work valuable, please consider citing the RADLADS paper:
@misc{goldstein2025radladsrapidattentiondistillation,
title={RADLADS: Rapid Attention Distillation to Linear Attention Decoders at Scale},
author={Daniel Goldstein and Eric Alcaide and Janna Lu and Eugene Cheah},
year={2025},
eprint={2505.03005},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.03005},
}
- Downloads last month
- 71