Text Generation
Transformers
Safetensors
qwen3
feature-extraction
speculative-decoding
dspark
specforge
sglang
qwen3.8
custom_code
text-generation-inference
Instructions to use RadixArk/Qwen3.8-27B-DSpark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RadixArk/Qwen3.8-27B-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RadixArk/Qwen3.8-27B-DSpark", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("RadixArk/Qwen3.8-27B-DSpark", trust_remote_code=True) model = AutoModel.from_pretrained("RadixArk/Qwen3.8-27B-DSpark", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RadixArk/Qwen3.8-27B-DSpark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RadixArk/Qwen3.8-27B-DSpark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RadixArk/Qwen3.8-27B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RadixArk/Qwen3.8-27B-DSpark
- SGLang
How to use RadixArk/Qwen3.8-27B-DSpark 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 "RadixArk/Qwen3.8-27B-DSpark" \ --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": "RadixArk/Qwen3.8-27B-DSpark", "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 "RadixArk/Qwen3.8-27B-DSpark" \ --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": "RadixArk/Qwen3.8-27B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RadixArk/Qwen3.8-27B-DSpark with Docker Model Runner:
docker model run hf.co/RadixArk/Qwen3.8-27B-DSpark
Fix DSpark reference generation block width
#2
by yisun0618 - opened
dflash.py
CHANGED
|
@@ -395,8 +395,9 @@ class DFlashDraftModel(Qwen3PreTrainedModel):
|
|
| 395 |
max_length = num_input_tokens + max_new_tokens
|
| 396 |
|
| 397 |
block_size = self.block_size
|
|
|
|
| 398 |
output_ids = torch.full(
|
| 399 |
-
(1, max_length +
|
| 400 |
self.mask_token_id,
|
| 401 |
dtype=torch.long,
|
| 402 |
device=target.device,
|
|
@@ -430,9 +431,14 @@ class DFlashDraftModel(Qwen3PreTrainedModel):
|
|
| 430 |
acceptance_lengths = []
|
| 431 |
start = input_ids.shape[1]
|
| 432 |
while start < max_length:
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
draft_logits = target.lm_head(
|
| 437 |
self(
|
| 438 |
target_hidden=target_hidden,
|
|
@@ -443,7 +449,7 @@ class DFlashDraftModel(Qwen3PreTrainedModel):
|
|
| 443 |
past_key_values=past_key_values_draft,
|
| 444 |
use_cache=True,
|
| 445 |
is_causal=False,
|
| 446 |
-
)[:, -block_size
|
| 447 |
)
|
| 448 |
past_key_values_draft.crop(start)
|
| 449 |
block_output_ids[:, 1:] = sample(draft_logits)
|
|
|
|
| 395 |
max_length = num_input_tokens + max_new_tokens
|
| 396 |
|
| 397 |
block_size = self.block_size
|
| 398 |
+
verify_width = block_size + 1
|
| 399 |
output_ids = torch.full(
|
| 400 |
+
(1, max_length + verify_width),
|
| 401 |
self.mask_token_id,
|
| 402 |
dtype=torch.long,
|
| 403 |
device=target.device,
|
|
|
|
| 431 |
acceptance_lengths = []
|
| 432 |
start = input_ids.shape[1]
|
| 433 |
while start < max_length:
|
| 434 |
+
# The draft has ``block_size`` noise rows. Row j predicts the token at
|
| 435 |
+
# start+j+1, so target verification consumes the anchor plus all draft
|
| 436 |
+
# proposals (``block_size + 1`` tokens).
|
| 437 |
+
block_output_ids = output_ids[:, start : start + verify_width].clone()
|
| 438 |
+
block_position_ids = position_ids[:, start : start + verify_width]
|
| 439 |
+
noise_embedding = target.model.embed_tokens(
|
| 440 |
+
block_output_ids[:, :block_size]
|
| 441 |
+
)
|
| 442 |
draft_logits = target.lm_head(
|
| 443 |
self(
|
| 444 |
target_hidden=target_hidden,
|
|
|
|
| 449 |
past_key_values=past_key_values_draft,
|
| 450 |
use_cache=True,
|
| 451 |
is_causal=False,
|
| 452 |
+
)[:, -block_size:, :]
|
| 453 |
)
|
| 454 |
past_key_values_draft.crop(start)
|
| 455 |
block_output_ids[:, 1:] = sample(draft_logits)
|