Upload folder using huggingface_hub
Browse files- config.json +78 -0
- config.py +55 -0
- model.safetensors +3 -0
config.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"DSparkDraftModel"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"": "config.DSparkSpeculatorConfig"
|
| 7 |
+
},
|
| 8 |
+
"aux_hidden_state_layer_ids": [
|
| 9 |
+
2,
|
| 10 |
+
12,
|
| 11 |
+
21
|
| 12 |
+
],
|
| 13 |
+
"block_size": 8,
|
| 14 |
+
"confidence_head_with_markov": true,
|
| 15 |
+
"draft_vocab_size": 8192,
|
| 16 |
+
"dtype": "bfloat16",
|
| 17 |
+
"enable_confidence_head": true,
|
| 18 |
+
"markov_head_type": "vanilla",
|
| 19 |
+
"markov_rank": 256,
|
| 20 |
+
"mask_token_id": 158685,
|
| 21 |
+
"sliding_window_non_causal": false,
|
| 22 |
+
"speculators_config": {
|
| 23 |
+
"algorithm": "dspark",
|
| 24 |
+
"default_proposal_method": "greedy",
|
| 25 |
+
"proposal_methods": [
|
| 26 |
+
{
|
| 27 |
+
"accept_tolerance": 0.0,
|
| 28 |
+
"proposal_type": "greedy",
|
| 29 |
+
"speculative_tokens": 7,
|
| 30 |
+
"verifier_accept_k": 1
|
| 31 |
+
}
|
| 32 |
+
],
|
| 33 |
+
"verifier": {
|
| 34 |
+
"architectures": [
|
| 35 |
+
"Qwen2ForCausalLM"
|
| 36 |
+
],
|
| 37 |
+
"name_or_path": "yuekai/Fun-CosyVoice3-0.5B-2512-LLM-HF"
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"speculators_model_type": "dspark",
|
| 41 |
+
"speculators_version": "0.7.0.dev81",
|
| 42 |
+
"target_hidden_size": null,
|
| 43 |
+
"tie_word_embeddings": false,
|
| 44 |
+
"transformer_layer_config": {
|
| 45 |
+
"attention_bias": false,
|
| 46 |
+
"attention_dropout": 0.0,
|
| 47 |
+
"bos_token_id": null,
|
| 48 |
+
"eos_token_id": null,
|
| 49 |
+
"head_dim": 64,
|
| 50 |
+
"hidden_act": "silu",
|
| 51 |
+
"hidden_size": 896,
|
| 52 |
+
"initializer_range": 0.02,
|
| 53 |
+
"intermediate_size": 4864,
|
| 54 |
+
"layer_types": [
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"sliding_attention"
|
| 58 |
+
],
|
| 59 |
+
"max_position_embeddings": 32768,
|
| 60 |
+
"max_window_layers": 28,
|
| 61 |
+
"model_type": "qwen3",
|
| 62 |
+
"num_attention_heads": 14,
|
| 63 |
+
"num_hidden_layers": 3,
|
| 64 |
+
"num_key_value_heads": 2,
|
| 65 |
+
"pad_token_id": null,
|
| 66 |
+
"rms_norm_eps": 1e-06,
|
| 67 |
+
"rope_parameters": {
|
| 68 |
+
"rope_theta": 1000000.0,
|
| 69 |
+
"rope_type": "default"
|
| 70 |
+
},
|
| 71 |
+
"sliding_window": 2048,
|
| 72 |
+
"tie_word_embeddings": false,
|
| 73 |
+
"use_cache": true,
|
| 74 |
+
"use_sliding_window": true,
|
| 75 |
+
"vocab_size": 158720
|
| 76 |
+
},
|
| 77 |
+
"transformers_version": "5.8.1"
|
| 78 |
+
}
|
config.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
from pydantic import Field
|
| 4 |
+
|
| 5 |
+
from speculators import SpeculatorModelConfig
|
| 6 |
+
from speculators.models.dflash.config import DFlashSpeculatorConfig
|
| 7 |
+
|
| 8 |
+
__all__ = [
|
| 9 |
+
"DSparkSpeculatorConfig",
|
| 10 |
+
]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@SpeculatorModelConfig.register("dspark")
|
| 14 |
+
class DSparkSpeculatorConfig(DFlashSpeculatorConfig):
|
| 15 |
+
"""DFlash config plus a Markov logit-bias head and a confidence head.
|
| 16 |
+
|
| 17 |
+
The Markov head lets each draft position condition on previously sampled
|
| 18 |
+
tokens within the block; the confidence head predicts the per-position
|
| 19 |
+
acceptance probability. All DFlash fields are inherited unchanged.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
speculators_model_type: Literal["dspark"] = "dspark" # type: ignore[assignment]
|
| 23 |
+
architectures: list[str] = Field(
|
| 24 |
+
default_factory=lambda: ["DSparkSpeculator"],
|
| 25 |
+
description="Model architectures that can load these weights",
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Sequential (Markov) head.
|
| 29 |
+
markov_rank: int = Field(
|
| 30 |
+
default=256,
|
| 31 |
+
description=(
|
| 32 |
+
"Low-rank dimension of the Markov logit-bias factorization B = W1 @ W2. "
|
| 33 |
+
"Set to 0 to disable the sequential head (pure DFlash drafting)."
|
| 34 |
+
),
|
| 35 |
+
)
|
| 36 |
+
markov_head_type: Literal["vanilla", "gated", "rnn"] = Field(
|
| 37 |
+
default="vanilla",
|
| 38 |
+
description=(
|
| 39 |
+
"Sequential head variant: 'vanilla' (first-order Markov bias), 'gated' "
|
| 40 |
+
"(hidden-gated bias), or 'rnn' (recurrent state over the block)."
|
| 41 |
+
),
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
# Confidence head.
|
| 45 |
+
enable_confidence_head: bool = Field(
|
| 46 |
+
default=True,
|
| 47 |
+
description="Whether to attach the per-position acceptance-probability head.",
|
| 48 |
+
)
|
| 49 |
+
confidence_head_with_markov: bool = Field(
|
| 50 |
+
default=True,
|
| 51 |
+
description=(
|
| 52 |
+
"Concatenate the Markov previous-token embedding with the backbone "
|
| 53 |
+
"hidden state as the confidence-head input."
|
| 54 |
+
),
|
| 55 |
+
)
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4bd5706d21aef622c3b644668549bc601a656fdfdde3f26886bdb6e1ec0d03b8
|
| 3 |
+
size 479084938
|