Skip to content

Commit

Permalink
fix unpack logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jambayk committed Jan 30, 2025
1 parent cac2f48 commit ba0f867
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/python/py/models/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ def make_mlp_unpacked_lora(self, layer_id, mlp, root_input):
up_proj.bias = None if gate_up_linear.bias is None else torch.nn.Parameter(gate_up_linear.bias[self.intermediate_size :], requires_grad=False)

# Create GateProj/UpProj lora_B layers
lora_B = mlp.lora_B.default
lora_B = gate_up_linear.lora_B.default

gate_proj_lora_B = torch.nn.Linear(in_features=self.hidden_size, out_features=self.intermediate_size)
gate_proj_lora_B.weight = torch.nn.Parameter(lora_B.weight[ : self.intermediate_size, :], requires_grad=False)
Expand All @@ -1712,12 +1712,12 @@ def make_mlp_unpacked_lora(self, layer_id, mlp, root_input):
up_proj_lora_B.bias = None if lora_B.bias is None else torch.nn.Parameter(lora_B.bias[self.intermediate_size :], requires_grad=False)

# Create GateProj/UpProj LoRA layers
mlp.gate_proj = LoraLayer(q_proj)
mlp.gate_proj = LoraLayer(gate_proj)
mlp.gate_proj.lora_A = gate_up_linear.lora_A
mlp.gate_proj.lora_B.default = gate_proj_lora_B
mlp.gate_proj.scaling = gate_up_linear.scaling

mlp.up_proj = LoraLayer(k_proj)
mlp.up_proj = LoraLayer(up_proj)
mlp.up_proj.lora_A = gate_up_linear.lora_A
mlp.up_proj.lora_B.default = up_proj_lora_B
mlp.up_proj.scaling = gate_up_linear.scaling
Expand Down

0 comments on commit ba0f867

Please sign in to comment.