MeganEFlynn commited on
Commit
d87b951
·
verified ·
1 Parent(s): 07426de

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. config.json +41 -0
  2. config.json.peagle_backup +68 -0
  3. config.py +82 -0
  4. model.safetensors +3 -0
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "eagle_aux_hidden_state_layer_ids": [
6
+ 1,
7
+ 17,
8
+ 29,
9
+ 47,
10
+ 58
11
+ ],
12
+ "attention_bias": false,
13
+ "attention_dropout": 0.0,
14
+ "bos_token_id": 1,
15
+ "eos_token_id": 2,
16
+ "head_dim": 256,
17
+ "hidden_act": "gelu_pytorch_tanh",
18
+ "hidden_size": 5376,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 21504,
21
+ "max_position_embeddings": 262144,
22
+ "mlp_bias": false,
23
+ "model_type": "llama",
24
+ "num_attention_heads": 32,
25
+ "num_hidden_layers": 1,
26
+ "num_key_value_heads": 16,
27
+ "pad_token_id": null,
28
+ "pretraining_tp": 1,
29
+ "rms_norm_eps": 1e-06,
30
+ "rope_parameters": {
31
+ "rope_theta": 10000.0,
32
+ "rope_type": "default"
33
+ },
34
+ "tie_word_embeddings": false,
35
+ "use_cache": true,
36
+ "vocab_size": 262144,
37
+ "draft_vocab_size": 32000,
38
+ "ptd_token_id": 4,
39
+ "dtype": "bfloat16",
40
+ "transformers_version": "5.6.2"
41
+ }
config.json.peagle_backup ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "PEagleDraftModel"
4
+ ],
5
+ "auto_map": {
6
+ "": "config.PEagleSpeculatorConfig"
7
+ },
8
+ "down_sample_ratio": 0.7,
9
+ "down_sample_ratio_min": 0.2,
10
+ "draft_vocab_size": 32000,
11
+ "dtype": "bfloat16",
12
+ "eagle_aux_hidden_state_layer_ids": null,
13
+ "embed_requires_grad": true,
14
+ "ptd_token_id": 4,
15
+ "max_seq_len": 2048,
16
+ "norm_before_fc": false,
17
+ "norm_before_residual": false,
18
+ "para_depths": 4,
19
+ "prediction_loss_weight": 1.0,
20
+ "speculators_config": {
21
+ "algorithm": "peagle",
22
+ "default_proposal_method": "greedy",
23
+ "proposal_methods": [
24
+ {
25
+ "accept_tolerance": 0.0,
26
+ "proposal_type": "greedy",
27
+ "speculative_tokens": 4,
28
+ "verifier_accept_k": 1
29
+ }
30
+ ],
31
+ "verifier": {
32
+ "architectures": [],
33
+ "name_or_path": "google/gemma-4-31B-it"
34
+ }
35
+ },
36
+ "speculators_model_type": "peagle",
37
+ "speculators_version": "0.5.0.dev100",
38
+ "target_hidden_size": null,
39
+ "tie_word_embeddings": false,
40
+ "transformer_layer_config": {
41
+ "attention_bias": false,
42
+ "attention_dropout": 0.0,
43
+ "bos_token_id": 1,
44
+ "eos_token_id": 2,
45
+ "head_dim": 256,
46
+ "hidden_act": "gelu_pytorch_tanh",
47
+ "hidden_size": 5376,
48
+ "initializer_range": 0.02,
49
+ "intermediate_size": 21504,
50
+ "max_position_embeddings": 262144,
51
+ "mlp_bias": false,
52
+ "model_type": "llama",
53
+ "num_attention_heads": 32,
54
+ "num_hidden_layers": 1,
55
+ "num_key_value_heads": 16,
56
+ "pad_token_id": null,
57
+ "pretraining_tp": 1,
58
+ "rms_norm_eps": 1e-06,
59
+ "rope_parameters": {
60
+ "rope_theta": 10000.0,
61
+ "rope_type": "default"
62
+ },
63
+ "tie_word_embeddings": false,
64
+ "use_cache": true,
65
+ "vocab_size": 262144
66
+ },
67
+ "transformers_version": "5.6.2"
68
+ }
config.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Literal
2
+
3
+ from pydantic import Field
4
+
5
+ from speculators import SpeculatorModelConfig
6
+ from speculators.models.eagle3.config import Eagle3SpeculatorConfig
7
+
8
+ __all__ = [
9
+ "PEagleSpeculatorConfig",
10
+ ]
11
+
12
+
13
+ @SpeculatorModelConfig.register("peagle")
14
+ class PEagleSpeculatorConfig(Eagle3SpeculatorConfig):
15
+ """
16
+ Configuration for P-EAGLE (Parallel EAGLE) speculator.
17
+
18
+ P-EAGLE extends EAGLE-3 with parallel multi-token prediction using
19
+ Conditional Drop Token (COD) sampling for memory-efficient training.
20
+
21
+ :param para_depths: Number of parallel prediction groups (typically 8)
22
+ :param down_sample_ratio: Geometric decay ratio for COD sampling (r in [0,1])
23
+ :param down_sample_ratio_min: Minimum retention ratio floor
24
+ :param mask_token_id: Token ID for predicted token dropout (padding unused positions)
25
+ :param max_seq_len: Maximum sequence length for attention mask construction
26
+ """
27
+
28
+ speculators_model_type: Literal["peagle"] = "peagle" # type: ignore[assignment]
29
+ architectures: list[str] = Field(
30
+ default_factory=lambda: ["PEagleSpeculator"],
31
+ description="Model architectures that can load these weights",
32
+ )
33
+
34
+ para_depths: int = Field(
35
+ default=8,
36
+ description="Number of parallel prediction groups (depths)",
37
+ ge=1,
38
+ le=16,
39
+ )
40
+
41
+ down_sample_ratio: float = Field(
42
+ default=0.7,
43
+ description="Geometric decay ratio for COD sampling (retention rate r)",
44
+ gt=0.0,
45
+ lt=1.0,
46
+ )
47
+
48
+ down_sample_ratio_min: float = Field(
49
+ default=0.1,
50
+ description="Minimum retention ratio floor to prevent over-sampling",
51
+ gt=0.0,
52
+ le=1.0,
53
+ )
54
+
55
+ mask_token_id: int | None = Field(
56
+ default=None,
57
+ description="Token ID used for padding unused positions in parallel groups",
58
+ )
59
+
60
+ max_seq_len: int = Field(
61
+ default=2048,
62
+ description="Maximum sequence length for attention mask construction",
63
+ ge=128,
64
+ le=8192,
65
+ )
66
+
67
+ # Override Eagle3 default: P-EAGLE requires trainable embeddings
68
+ # (matches p-eagle-train)
69
+ embed_requires_grad: bool = Field(
70
+ default=True,
71
+ description=(
72
+ "Whether embedding layer weights require gradients during "
73
+ "training (True for P-EAGLE)"
74
+ ),
75
+ )
76
+
77
+ prediction_loss_weight: float = Field(
78
+ default=1.0,
79
+ description="Weight for prediction loss (cross-entropy on logits). "
80
+ "P-eagle-train uses only prediction loss, no hidden state distillation.",
81
+ gt=0.0,
82
+ )
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee39d56aaf2d5199de3bf8d6a3db4cf7e5c5d1832bfe59a903ca224716fad39f
3
+ size 4586301640