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
ea8ffe36
"tests/ctrl/test_modeling_ctrl.py" did not exist on "e983da0e7d91c100e6e35efcb8a69c8cd41d6e09"
Unverified
Commit
ea8ffe36
authored
Aug 12, 2021
by
Sylvain Gugger
Committed by
GitHub
Aug 12, 2021
Browse files
Proper import for unittest.mock.patch (#13085)
parent
d329b633
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
tests/test_trainer_callback.py
tests/test_trainer_callback.py
+2
-1
No files found.
tests/test_trainer_callback.py
View file @
ea8ffe36
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
shutil
import
shutil
import
tempfile
import
tempfile
import
unittest
import
unittest
from
unittest.mock
import
patch
from
transformers
import
(
from
transformers
import
(
DefaultFlowCallback
,
DefaultFlowCallback
,
...
@@ -234,7 +235,7 @@ class TrainerCallbackTest(unittest.TestCase):
...
@@ -234,7 +235,7 @@ class TrainerCallbackTest(unittest.TestCase):
self
.
assertEqual
(
events
,
self
.
get_expected_events
(
trainer
))
self
.
assertEqual
(
events
,
self
.
get_expected_events
(
trainer
))
# warning should be emitted for duplicated callbacks
# warning should be emitted for duplicated callbacks
with
unittest
.
mock
.
patch
(
"transformers.trainer_callback.logger.warning"
)
as
warn_mock
:
with
patch
(
"transformers.trainer_callback.logger.warning"
)
as
warn_mock
:
trainer
=
self
.
get_trainer
(
trainer
=
self
.
get_trainer
(
callbacks
=
[
MyTestTrainerCallback
,
MyTestTrainerCallback
],
callbacks
=
[
MyTestTrainerCallback
,
MyTestTrainerCallback
],
)
)
...
...
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