Skip to content

Commit

Permalink
[Misc] Medusa supports custom bias (#10361)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylee-01 authored Nov 16, 2024
1 parent 8b6725b commit b98d89e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vllm/model_executor/models/medusa.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

class ResidualBlock(nn.Module):

def __init__(self, hidden_size: int, num_layers: int) -> None:
def __init__(self, config: VllmConfig, hidden_size: int,
num_layers: int) -> None:
super().__init__()

self.layers = nn.ModuleList([
nn.Linear(hidden_size, hidden_size, bias=False)
nn.Linear(hidden_size,
hidden_size,
bias=getattr(config, "medusa_fc_bias", False))
for _ in range(num_layers)
])
self.act = nn.SiLU()
Expand Down Expand Up @@ -49,7 +52,8 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = "") -> None:
super().__init__()
self.config = config
self.blocks = nn.ModuleList([
ResidualBlock(hidden_size=self.config.hidden_size,
ResidualBlock(config=config,
hidden_size=self.config.hidden_size,
num_layers=self.config.num_hidden_layers)
for _ in range(self.config.num_heads)
])
Expand Down

0 comments on commit b98d89e

Please sign in to comment.