Skip to content

Commit 3a87306

Browse files
committed
fix some error
1 parent e956ba7 commit 3a87306

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

paddlenlp/transformers/qwen/modeling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,18 @@ def __init__(self, config):
160160
has_bias=True,
161161
gather_output=False,
162162
)
163-
self.o_proj = RowParallelLinear(
163+
self.c_proj = RowParallelLinear(
164164
config.hidden_size,
165165
self.projection_size,
166166
has_bias=False,
167167
input_is_parallel=True,
168168
)
169169
else:
170170
self.c_attn = nn.Linear(config.hidden_size, 3 * self.projection_size, bias_attr=True)
171-
self.o_proj = nn.Linear(
171+
self.c_proj = nn.Linear(
172172
config.hidden_size,
173173
self.projection_size,
174-
bias_attr=False,
174+
bias_attr=not config.no_bias,
175175
)
176176

177177
if config.rotary_pct == 1.0:
@@ -377,7 +377,7 @@ def forward(
377377

378378
# if sequence_parallel is true, out shape are [q_len / n, bs, num_head * head_dim]
379379
# else their shape are [bs, q_len, num_head * head_dim], n is mp parallelism.
380-
attn_output = self.o_proj(attn_output)
380+
attn_output = self.c_proj(attn_output)
381381
outputs = (attn_output, present)
382382
if output_attentions:
383383
outputs += (attn_weight,)
@@ -576,8 +576,8 @@ def _get_name_mappings(cls, config: QWenConfig) -> List[StateDictNameMapping]:
576576
f"h.{layer_index}.attn.c_attn.bias",
577577
],
578578
[
579-
f"h.{layer_index}.attn.o_proj.weight",
580-
f"h.{layer_index}.attn.o_proj.weight",
579+
f"h.{layer_index}.attn.c_proj.weight",
580+
f"h.{layer_index}.attn.c_proj.weight",
581581
"transpose",
582582
],
583583
[

0 commit comments

Comments
 (0)