Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
fa2c49b0
Unverified
Commit
fa2c49b0
authored
Apr 01, 2024
by
Arthur
Committed by
GitHub
Apr 01, 2024
Browse files
Fix copies main ci (#29979)
* fix copies * nit * style * Update utils/check_copies.py
parent
569f6c7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
tests/models/qwen2_moe/test_modeling_qwen2_moe.py
tests/models/qwen2_moe/test_modeling_qwen2_moe.py
+1
-1
utils/check_copies.py
utils/check_copies.py
+22
-5
No files found.
tests/models/qwen2_moe/test_modeling_qwen2_moe.py
View file @
fa2c49b0
...
...
@@ -504,7 +504,7 @@ class Qwen2MoeModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterM
@
require_torch_gpu
@
pytest
.
mark
.
flash_attn_test
@
slow
def
test_flash_attn_2_inference_padding
_right
(
self
):
def
test_flash_attn_2_inference_
equivalence_right_
padding
(
self
):
self
.
skipTest
(
"Qwen2Moe flash attention does not support right padding"
)
# Ignore copy
...
...
utils/check_copies.py
View file @
fa2c49b0
...
...
@@ -313,10 +313,12 @@ def split_code_into_blocks(
target_block_name
=
re
.
search
(
rf
"^
{
' '
*
(
indent
-
4
)
}
((class|def)\s+\S+)(\(|\:)"
,
lines
[
start_index
]
).
groups
()[
0
]
except
ValueError
:
except
Exception
:
start_context
=
min
(
start_index
-
10
,
0
)
end_context
=
min
(
end_index
+
10
,
len
(
lines
))
raise
ValueError
(
f
"Tried to split a class or function. It did not work. Error comes from line
{
start_index
}
: ```
\n
"
+
""
.
join
(
lines
[
start_
ind
ex
:
end_
ind
ex
])
f
"Tried to split a class or function. It did not work. Error comes from line
{
start_index
}
:
\n
```
\n
"
+
""
.
join
(
lines
[
start_
cont
ex
t
:
end_
cont
ex
t
])
+
"```
\n
"
)
...
...
@@ -602,8 +604,23 @@ def check_codes_match(observed_code: str, theoretical_code: str) -> Optional[int
_re_func_match
=
re
.
compile
(
r
"def\s+([^\(]+)\("
)
for
re_pattern
in
[
_re_class_match
,
_re_func_match
]:
if
re_pattern
.
match
(
observed_code_header
)
is
not
None
:
observed_obj_name
=
re_pattern
.
search
(
observed_code_header
).
groups
()[
0
]
theoretical_name
=
re_pattern
.
search
(
theoretical_code_header
).
groups
()[
0
]
try
:
observed_obj_name
=
re_pattern
.
search
(
observed_code_header
).
groups
()[
0
]
except
Exception
:
raise
ValueError
(
"Tried to split a class or function. It did not work. Error comes from:
\n
```
\n
"
+
observed_code_header
+
"
\n
```
\n
"
)
try
:
theoretical_name
=
re_pattern
.
search
(
theoretical_code_header
).
groups
()[
0
]
except
Exception
:
raise
ValueError
(
"Tried to split a class or function. It did not work. Error comes from:
\n
```
\n
"
+
theoretical_code_header
+
"
\n
```
\n
"
)
theoretical_code_header
=
theoretical_code_header
.
replace
(
theoretical_name
,
observed_obj_name
)
# Find the first diff. Line 0 is special since we need to compare with the function/class names ignored.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment