EAGLE-3 Korean draft for gemma-4-31B-it (seq-len 8192)
Browse files- config.json +66 -0
- config.py +93 -0
- model.safetensors +3 -0
- optimizer_state_dict.pt +3 -0
- scheduler_state_dict.pt +3 -0
- val_metrics.json +1 -0
config.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Eagle3DraftModel"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"": "config.Eagle3SpeculatorConfig"
|
| 7 |
+
},
|
| 8 |
+
"draft_vocab_size": 32000,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"eagle_aux_hidden_state_layer_ids": [
|
| 11 |
+
2,
|
| 12 |
+
30,
|
| 13 |
+
57
|
| 14 |
+
],
|
| 15 |
+
"embed_requires_grad": false,
|
| 16 |
+
"norm_before_fc": false,
|
| 17 |
+
"norm_before_residual": true,
|
| 18 |
+
"speculators_config": {
|
| 19 |
+
"algorithm": "eagle3",
|
| 20 |
+
"default_proposal_method": "greedy",
|
| 21 |
+
"proposal_methods": [
|
| 22 |
+
{
|
| 23 |
+
"accept_tolerance": 0.0,
|
| 24 |
+
"proposal_type": "greedy",
|
| 25 |
+
"speculative_tokens": 3,
|
| 26 |
+
"verifier_accept_k": 1
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"verifier": {
|
| 30 |
+
"architectures": [],
|
| 31 |
+
"name_or_path": "google/gemma-4-31B-it"
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
"speculators_model_type": "eagle3",
|
| 35 |
+
"speculators_version": "0.5.0.dev27",
|
| 36 |
+
"target_hidden_size": null,
|
| 37 |
+
"tie_word_embeddings": false,
|
| 38 |
+
"transformer_layer_config": {
|
| 39 |
+
"attention_bias": false,
|
| 40 |
+
"attention_dropout": 0.0,
|
| 41 |
+
"bos_token_id": 1,
|
| 42 |
+
"eos_token_id": 2,
|
| 43 |
+
"head_dim": 256,
|
| 44 |
+
"hidden_act": "silu",
|
| 45 |
+
"hidden_size": 5376,
|
| 46 |
+
"initializer_range": 0.02,
|
| 47 |
+
"intermediate_size": 21504,
|
| 48 |
+
"max_position_embeddings": 262144,
|
| 49 |
+
"mlp_bias": false,
|
| 50 |
+
"model_type": "llama",
|
| 51 |
+
"num_attention_heads": 32,
|
| 52 |
+
"num_hidden_layers": 1,
|
| 53 |
+
"num_key_value_heads": 16,
|
| 54 |
+
"pad_token_id": null,
|
| 55 |
+
"pretraining_tp": 1,
|
| 56 |
+
"rms_norm_eps": 1e-06,
|
| 57 |
+
"rope_parameters": {
|
| 58 |
+
"rope_theta": 10000.0,
|
| 59 |
+
"rope_type": "default"
|
| 60 |
+
},
|
| 61 |
+
"tie_word_embeddings": false,
|
| 62 |
+
"use_cache": true,
|
| 63 |
+
"vocab_size": 262144
|
| 64 |
+
},
|
| 65 |
+
"transformers_version": "5.12.1"
|
| 66 |
+
}
|
config.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Literal
|
| 2 |
+
|
| 3 |
+
from pydantic import Field, field_serializer, field_validator
|
| 4 |
+
from transformers import AutoConfig, PretrainedConfig
|
| 5 |
+
from transformers.models.llama.configuration_llama import LlamaConfig
|
| 6 |
+
|
| 7 |
+
from speculators import SpeculatorModelConfig
|
| 8 |
+
|
| 9 |
+
__all__ = [
|
| 10 |
+
"Eagle3SpeculatorConfig",
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@SpeculatorModelConfig.register("eagle3")
|
| 15 |
+
class Eagle3SpeculatorConfig(SpeculatorModelConfig):
|
| 16 |
+
"""
|
| 17 |
+
Configuration for EAGLE-3 speculator with vocabulary mapping.
|
| 18 |
+
|
| 19 |
+
EAGLE-3 features vocabulary mapping between draft (32K) and target (128K)
|
| 20 |
+
vocabularies, enabling cross-tokenizer speculation.
|
| 21 |
+
|
| 22 |
+
:param transformer_layer_config: Configuration for the transformer decoder layer
|
| 23 |
+
:param draft_vocab_size: Size of draft model vocabulary for speculation
|
| 24 |
+
:param norm_before_residual: Apply hidden_norm before storing residual
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
speculators_model_type: Literal["eagle3"] = "eagle3"
|
| 28 |
+
architectures: list[str] = Field(
|
| 29 |
+
default_factory=lambda: ["Eagle3Speculator"],
|
| 30 |
+
description="Model architectures that can load these weights",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
transformer_layer_config: PretrainedConfig = Field(
|
| 34 |
+
default_factory=LlamaConfig,
|
| 35 |
+
description="Configuration for the transformer decoder layer",
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
draft_vocab_size: int = Field(
|
| 39 |
+
default=32000,
|
| 40 |
+
description="Size of draft model vocabulary for speculation",
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
norm_before_residual: bool = Field(
|
| 44 |
+
default=False,
|
| 45 |
+
description="Apply hidden_norm before storing residual",
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
target_hidden_size: int | None = Field(
|
| 49 |
+
default=None,
|
| 50 |
+
description="Hidden size of the target model (if different from draft model)",
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
eagle_aux_hidden_state_layer_ids: list[int] | None = Field(
|
| 54 |
+
default=None,
|
| 55 |
+
description="Layer IDs of the Eagle auxiliary hidden state layers",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
norm_before_fc: bool = Field(
|
| 59 |
+
default=False,
|
| 60 |
+
description=(
|
| 61 |
+
"If True, vLLM will add and apply RMSNorm before the fc layer when loading "
|
| 62 |
+
"this draft model (e.g. for gpt-oss draft checkpoints). Set in config when "
|
| 63 |
+
"converting or saving gpt-oss draft models."
|
| 64 |
+
),
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
embed_requires_grad: bool = Field(
|
| 68 |
+
default=False,
|
| 69 |
+
description="Whether embedding layer weights require gradients during training",
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
@field_serializer("transformer_layer_config")
|
| 73 |
+
def serialize_transformer_config(self, value: PretrainedConfig) -> dict:
|
| 74 |
+
"""Serialize transformer config to dict."""
|
| 75 |
+
return value.to_diff_dict()
|
| 76 |
+
|
| 77 |
+
@field_validator("transformer_layer_config", mode="before")
|
| 78 |
+
@classmethod
|
| 79 |
+
def validate_transformer_config(cls, value: Any) -> PretrainedConfig:
|
| 80 |
+
"""Validate and convert transformer config."""
|
| 81 |
+
if isinstance(value, dict):
|
| 82 |
+
config_class: type[PretrainedConfig] = LlamaConfig
|
| 83 |
+
if "model_type" in value:
|
| 84 |
+
config_class = AutoConfig.for_model(
|
| 85 |
+
model_type=value["model_type"]
|
| 86 |
+
).__class__
|
| 87 |
+
return config_class(**value)
|
| 88 |
+
return value
|
| 89 |
+
|
| 90 |
+
@property
|
| 91 |
+
def target_vocab_size(self) -> int:
|
| 92 |
+
"""Get target vocabulary size from transformer config."""
|
| 93 |
+
return self.transformer_layer_config.vocab_size
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c3067b281a6612a41f6f195ccfff574a386121f99fc817ff61e0a9bdfb16c6c
|
| 3 |
+
size 4470642280
|
optimizer_state_dict.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9c412c819e6fed56ffacc244252f40754b86c298d905ef98fbfe81f5780f892
|
| 3 |
+
size 2614984665
|
scheduler_state_dict.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0e4e931e23da4f9772178ac65b35ad8b532e12ae61cd24396c58918328ad97e2
|
| 3 |
+
size 1531
|
val_metrics.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"loss_0_epoch": 1.9602829618689581, "full_acc_0_epoch": 0.6379972797349239, "cond_acc_0_epoch": 0.6379972797349239, "loss_1_epoch": 3.1759868421052633, "full_acc_1_epoch": 0.3797289321761222, "cond_acc_1_epoch": 0.5951889517991245, "loss_2_epoch": 4.022086466165414, "full_acc_2_epoch": 0.23484306047796374, "cond_acc_2_epoch": 0.6184231131679151, "loss_epoch": 9.158356270139635}
|