Skip to content

Commit 8255fbb

Browse files
author
Weifan Jiang
committed
remove redundant argument path
1 parent c5ebff2 commit 8255fbb

2 files changed

Lines changed: 4 additions & 20 deletions

File tree

src/speculators/models/dflash/config.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,6 @@ class DFlashSpeculatorConfig(SpeculatorModelConfig):
7070
"bidirectional.",
7171
)
7272

73-
per_position_loss_weight: Literal["fixed-exp-decay", "dpace"] = Field(
74-
default="fixed-exp-decay",
75-
description="Per-position weighting of the block-drafting loss: "
76-
"fixed-exp-decay uses original D-Flash loss. dpace uses confidence"
77-
"to change per-position weights dynamically."
78-
)
79-
80-
dpace_alpha: float = Field(
81-
default=0.5,
82-
ge=0.0,
83-
le=1.0,
84-
description="Smoothing constant for D-PACE loss"
85-
)
86-
8773
@field_serializer("transformer_layer_config")
8874
def serialize_transformer_config(self, value: PretrainedConfig) -> dict:
8975
"""Serialize transformer config to dict."""

src/speculators/models/dflash/core.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ def __init__(
105105
)
106106
self.verifier_norm.weight.requires_grad = False
107107
self.block_size = config.block_size
108-
self.per_position_loss_weight = config.per_position_loss_weight
109-
self.dpace_alpha = config.dpace_alpha
110108
self.post_init()
111109

112110
@property
@@ -183,8 +181,6 @@ def _build_base_config_kwargs(
183181
"aux_hidden_state_layer_ids": target_layer_ids,
184182
"mask_token_id": kwargs.get("mask_token_id"),
185183
"sliding_window_non_causal": kwargs.get("sliding_window_non_causal", False),
186-
"per_position_loss_weight": kwargs.get("per_position_loss_weight", "fixed-exp-decay"),
187-
"dpace_alpha": kwargs.get("dpace_alpha", 0.5),
188184
"speculators_config": SpeculatorsConfig(
189185
algorithm=algorithm,
190186
proposal_methods=[
@@ -401,6 +397,8 @@ def forward(
401397
loss_config: LossConfig | None = None,
402398
gamma: float = 4.0,
403399
max_anchors: int = 3072,
400+
per_position_loss_weight: str = "fixed-exp-decay",
401+
dpace_alpha: float = 0.5,
404402
**kwargs,
405403
):
406404
_, logits, targets, aligned_loss_mask, _ = self._backbone_forward(
@@ -420,8 +418,8 @@ def forward(
420418
self.block_size,
421419
gamma=gamma,
422420
loss_config=loss_config,
423-
per_position_loss_weight=self.per_position_loss_weight,
424-
dpace_alpha=self.dpace_alpha,
421+
per_position_loss_weight=per_position_loss_weight,
422+
dpace_alpha=dpace_alpha,
425423
)
426424
draft_tokens = torch.argmax(logits, dim=-1)
427425

0 commit comments

Comments
 (0)