Skip to content

Commit 058eb4b

Browse files
committed
fix bias
1 parent 449c551 commit 058eb4b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lightllm/common/basemodel/layer_weights/meta_weights/mm_weight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def load_hf_weights(self, weights):
8585
weight = weights[self.weight_name].to(self.data_type_)
8686
self.weight = weight[:, start:end]
8787
if self.bias_name in weights:
88-
bias = weights[self.bias_name].to(self.data_type)
88+
bias = weights[self.bias_name].to(self.data_type_)
8989
self.bias = bias.cuda(self.tp_rank_) / self.world_size_
9090
if weight is None:
9191
return
@@ -122,7 +122,7 @@ def _fuse(self):
122122
self._post_load_weights()
123123
if self.has_bias:
124124
if self.bias is None and all(b is not None for b in self.biases):
125-
self.bias = torch.cat(self.bias, dim=0).cuda(self.tp_rank_)
125+
self.bias = torch.cat(self.biases, dim=0).cuda(self.tp_rank_)
126126
return self
127127

128128
def load_hf_weights(self, weights):

lightllm/models/internlm/layer_weights/transformer_layer_weight.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, layer_num, tp_rank, world_size, data_type, network_config, mo
1313

1414
def _init_weight_names(self):
1515
super()._init_weight_names()
16-
self._q_bias_name = f"{self.layer_name}.self_attn.q_proj.bias"
17-
self._k_bias_name = f"{self.layer_name}.self_attn.k_proj.bias"
18-
self._v_bias_name = f"{self.layer_name}.self_attn.v_proj.bias"
19-
self._o_bias_name = f"{self.layer_name}.self_attn.o_proj.bias"
16+
self._q_bias_name = f"model.layers.{self.layer_num_}.self_attn.q_proj.bias"
17+
self._k_bias_name = f"model.layers.{self.layer_num_}.self_attn.k_proj.bias"
18+
self._v_bias_name = f"model.layers.{self.layer_num_}.self_attn.v_proj.bias"
19+
self._o_bias_name = f"model.layers.{self.layer_num_}.self_attn.o_proj.bias"

0 commit comments

Comments
 (0)