Text Generation
Transformers
PyTorch
MLX
English
tree-attention
apple-m4
mps
structured-generation
parallel-decoding
constrained-decoding
apple-silicon
classification
json
Instructions to use epsilon3/Qwen-2.5-1B-RLCD-Fast with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="epsilon3/Qwen-2.5-1B-RLCD-Fast")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("epsilon3/Qwen-2.5-1B-RLCD-Fast", device_map="auto") - MLX
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("epsilon3/Qwen-2.5-1B-RLCD-Fast") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "epsilon3/Qwen-2.5-1B-RLCD-Fast" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "epsilon3/Qwen-2.5-1B-RLCD-Fast", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/epsilon3/Qwen-2.5-1B-RLCD-Fast
- SGLang
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast 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 "epsilon3/Qwen-2.5-1B-RLCD-Fast" \ --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": "epsilon3/Qwen-2.5-1B-RLCD-Fast", "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 "epsilon3/Qwen-2.5-1B-RLCD-Fast" \ --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": "epsilon3/Qwen-2.5-1B-RLCD-Fast", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - MLX LM
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "epsilon3/Qwen-2.5-1B-RLCD-Fast" --prompt "Once upon a time"
- Docker Model Runner
How to use epsilon3/Qwen-2.5-1B-RLCD-Fast with Docker Model Runner:
docker model run hf.co/epsilon3/Qwen-2.5-1B-RLCD-Fast
- Atomic Chat
Download test_sdk.py from epsilon3/Qwen-2.5-1B-RLCD-Fast: direct link, hf CLI and curl.
- Browser
- Download file 1.86 kB
-
https://huggingface.co/epsilon3/Qwen-2.5-1B-RLCD-Fast/resolve/main/test_sdk.py
- Command line
-
hf download hf://epsilon3/Qwen-2.5-1B-RLCD-Fast/test_sdk.py
-
curl -L -o test_sdk.py https://huggingface.co/epsilon3/Qwen-2.5-1B-RLCD-Fast/resolve/main/test_sdk.py
1.86 kB
| """Check the published SDK router and adapter without downloading weights.""" | |
| import unittest | |
| from unittest.mock import patch | |
| import torch | |
| from transformers import Qwen2Config, Qwen2ForCausalLM | |
| from core.engine import run_parallel_generation | |
| from core.schema import StructuredSchema | |
| class Tokenizer: | |
| pad_token_id = 0 | |
| def encode(self, text, return_tensors=None, **kwargs): | |
| ids = [1 + ord(c) % 95 for c in text] | |
| return torch.tensor([ids]) if return_tensors == 'pt' else ids | |
| class SDKTest(unittest.TestCase): | |
| def test_tree_is_default_and_preserves_response(self): | |
| torch.set_num_threads(2) | |
| torch.manual_seed(42) | |
| config = Qwen2Config(vocab_size=97, hidden_size=64, intermediate_size=128, | |
| num_hidden_layers=2, num_attention_heads=4, num_key_value_heads=2) | |
| config._attn_implementation = 'sdpa' | |
| model = Qwen2ForCausalLM(config).eval() | |
| schema = StructuredSchema({'risk': {'type':'boolean', 'description':'Risk present'}, | |
| 'level': {'type':'enum', 'description':'Risk level', 'choices':['LOW','HIGH']}}) | |
| self.assertEqual(run_parallel_generation.__module__, 'core.engine_tree') | |
| with patch('core.engine_tree.get_torch_engine', return_value=(model, Tokenizer(), 'cpu')): | |
| result = run_parallel_generation('A suspicious request.', schema) | |
| self.assertEqual(result['mode'], 'parallel_constrained_tree') | |
| self.assertEqual(set(result['parsed_json']), {'risk', 'level'}) | |
| self.assertIsInstance(result['parsed_json']['risk']['value'], bool) | |
| self.assertIn(result['parsed_json']['level']['value'], ['LOW', 'HIGH']) | |
| self.assertFalse(result['has_calibrated_probabilities']) | |
| self.assertEqual(result['num_fields'], 2) | |
| if __name__ == '__main__': | |
| unittest.main() | |