Skip to content

Commit

Permalink
fix-copies
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Jun 3, 2024
1 parent b67782d commit 6a3eaa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/transformers/models/mistral/modeling_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ def forward(
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)

cos, sin = self.rotary_emb(value_states, position_ids)

query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)

if past_key_value is not None:
Expand Down Expand Up @@ -656,7 +655,7 @@ def forward(
)

attn_output = attn_output.transpose(1, 2).contiguous()
attn_output = attn_output.view(bsz, q_len, self.hidden_size)
attn_output = attn_output.view(bsz, q_len, -1)

attn_output = self.o_proj(attn_output)

Expand Down
8 changes: 4 additions & 4 deletions utils/diff_model_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ def update_body(self, existing_body, new_statements):
existing_nodes = set()
for node in new_statements:
code = self.python_module.code_for_node(node)
comment_less_code = re.sub(r'#.*', '', code).strip()
comment_less_code = re.sub(r'\ *\n', '\n', comment_less_code).strip()
comment_less_code = re.sub(r"#.*", "", code).strip()
comment_less_code = re.sub(r"\ *\n", "\n", comment_less_code).strip()
existing_nodes.add(comment_less_code)
for stmt in existing_body:
comment_less_code = re.sub(r'#.*', '',self.python_module.code_for_node(stmt)).strip()
comment_less_code = re.sub(r'\ *\n', '\n', comment_less_code).strip()
comment_less_code = re.sub(r"#.*", "", self.python_module.code_for_node(stmt)).strip()
comment_less_code = re.sub(r"\ *\n", "\n", comment_less_code).strip()
if comment_less_code not in existing_nodes:
if m.matches(stmt, DOCSTRING_NODE) and self.has_docstring:
continue
Expand Down

0 comments on commit 6a3eaa4

Please sign in to comment.