Instructions to use jeongseokoh/Qwen3-8B_SPEED-24-BoS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use jeongseokoh/Qwen3-8B_SPEED-24-BoS with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B") model = PeftModel.from_pretrained(base_model, "jeongseokoh/Qwen3-8B_SPEED-24-BoS") - Transformers
How to use jeongseokoh/Qwen3-8B_SPEED-24-BoS with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jeongseokoh/Qwen3-8B_SPEED-24-BoS", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jeongseokoh/Qwen3-8B_SPEED-24-BoS", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("jeongseokoh/Qwen3-8B_SPEED-24-BoS", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jeongseokoh/Qwen3-8B_SPEED-24-BoS with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jeongseokoh/Qwen3-8B_SPEED-24-BoS" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jeongseokoh/Qwen3-8B_SPEED-24-BoS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jeongseokoh/Qwen3-8B_SPEED-24-BoS
- SGLang
How to use jeongseokoh/Qwen3-8B_SPEED-24-BoS 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 "jeongseokoh/Qwen3-8B_SPEED-24-BoS" \ --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": "jeongseokoh/Qwen3-8B_SPEED-24-BoS", "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 "jeongseokoh/Qwen3-8B_SPEED-24-BoS" \ --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": "jeongseokoh/Qwen3-8B_SPEED-24-BoS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jeongseokoh/Qwen3-8B_SPEED-24-BoS with Docker Model Runner:
docker model run hf.co/jeongseokoh/Qwen3-8B_SPEED-24-BoS
Use Docker
docker model run hf.co/jeongseokoh/Qwen3-8B_SPEED-24-BoSQwen3-8B SPEED-24-BoS
This repository contains a SPEED LoRA adapter for Qwen/Qwen3-8B.
It is not a standalone full-weight checkpoint. At load time, Transformers/PEFT
will need access to the base model Qwen/Qwen3-8B, then apply the adapter in
this repository.
The repository also bundles the minimal Qwen3 SPEED remote-code runtime needed for inference:
modeling_speed.pymodeling_speed_qwen3.pyspeed_inference.pyspeed_decoder_modeling.pyspeed_modeling_common.py- prompt/tokenizer helper files
You do not need the original SPEED source repository on the inference server,
but you must load with trust_remote_code=True.
SPEED Configuration
This checkpoint was trained and exported with:
| Setting | Value |
|---|---|
| Base model | Qwen/Qwen3-8B |
| Adapter type | LoRA |
| Lower SPEED layers | 24 |
| Prompt prefill mode | lower layers only |
| Upper prompt targets | bos,assistant |
| Prefill attention | causal |
| Decode tokens | full-depth |
For faithful inference, use lower_k=24 and speed_upper_targets=("bos", "assistant").
Installation
Use a recent CUDA/PyTorch environment suitable for Qwen3-8B. The checkpoint was created with these library versions:
pip install "transformers==4.57.6" "peft==0.19.1" huggingface_hub accelerate safetensors
Install PyTorch separately if your server needs a specific CUDA wheel.
Basic SPEED Inference
import sys
import torch
from huggingface_hub import snapshot_download
model_id = "jeongseokoh/Qwen3-8B_SPEED-24-BoS"
repo_dir = snapshot_download(model_id)
sys.path.insert(0, repo_dir)
from speed_inference import load_speed_model
model, tokenizer = load_speed_model(
repo_dir,
dtype=torch.bfloat16,
device_map="auto",
speed_generate=True,
speed_layers=24,
speed_attn="causal",
speed_upper_targets=("bos", "assistant"),
)
model.eval()
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"},
]
with torch.inference_mode():
outputs = model.generate(
speed_generate=True,
messages=messages,
lower_k=24,
speed_upper_targets=("bos", "assistant"),
max_new_tokens=256,
do_sample=True,
temperature=0.6,
top_p=0.95,
top_k=20,
return_dict_in_generate=True,
)
prompt_len = outputs["prompt_lengths"][0]
generated_ids = outputs["sequences"][0, prompt_len:]
print(tokenizer.decode(generated_ids, skip_special_tokens=True))
Document or Long-Context Inference
The SPEED hook accepts chat-style messages and an optional context. The
context span is processed as prompt context according to the SPEED prefill rule.
question = "What are the key claims in the document?"
document = "..." # long document text
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": question},
]
with torch.inference_mode():
outputs = model.generate(
speed_generate=True,
messages=messages,
context=document,
lower_k=24,
speed_upper_targets=("bos", "assistant"),
max_new_tokens=512,
do_sample=False,
return_dict_in_generate=True,
)
prompt_len = outputs["prompt_lengths"][0]
print(tokenizer.decode(outputs["sequences"][0, prompt_len:], skip_special_tokens=True))
Returning Text Directly
For convenience, the bundled runtime can return decoded text directly. Keep
return_dict_in_generate=True so the prompt length is handled correctly.
text = model.generate(
speed_generate=True,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Give me a short answer."},
],
lower_k=24,
max_new_tokens=128,
return_dict_in_generate=True,
return_text=True,
)
print(text)
Important Notes
- This repository is a PEFT adapter repo. Do not pass SPEED-only arguments such
as
speed_generatedirectly toAutoModelForCausalLM.from_pretrained(model_id, ...); Transformers/PEFT may route that call through the baseQwen3ForCausalLMclass, which does not accept those arguments. - Use
snapshot_download()and the bundledspeed_inference.load_speed_model()entrypoint as shown above. The original SPEED source repository is not needed on the inference server. - Always pass
speed_generate=Truefor SPEED inference. Calling ordinarygenerate()withoutspeed_generate=Trueuses the normal generation path. - This is a PEFT adapter. The base model
Qwen/Qwen3-8Bmust be downloadable from the inference server. pipeline("text-generation", ...)is not recommended because the SPEED API needs structured arguments such asmessages,context, andlower_k.- vLLM serving is not covered by this adapter repository. Use the Transformers path above unless you have a separate SPEED-vLLM runtime.
Files
Only the Qwen3 SPEED modeling file is included. Mistral/Ministral modeling files are intentionally omitted from this upload artifact.
- Downloads last month
- 4
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "jeongseokoh/Qwen3-8B_SPEED-24-BoS"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jeongseokoh/Qwen3-8B_SPEED-24-BoS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'