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
13deb95a
Unverified
Commit
13deb95a
authored
Jul 01, 2020
by
Sam Shleifer
Committed by
GitHub
Jul 01, 2020
Browse files
Move tests/utils.py -> transformers/testing_utils.py (#5350)
parent
9c219305
Changes
66
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
20 additions
and
27 deletions
+20
-27
examples/seq2seq/finetune_bart_tiny.sh
examples/seq2seq/finetune_bart_tiny.sh
+1
-1
examples/seq2seq/test_seq2seq_examples.py
examples/seq2seq/test_seq2seq_examples.py
+2
-1
src/transformers/testing_utils.py
src/transformers/testing_utils.py
+0
-0
tests/test_activations.py
tests/test_activations.py
+1
-2
tests/test_benchmark.py
tests/test_benchmark.py
+1
-2
tests/test_benchmark_tf.py
tests/test_benchmark_tf.py
+1
-2
tests/test_configuration_auto.py
tests/test_configuration_auto.py
+1
-2
tests/test_doc_samples.py
tests/test_doc_samples.py
+1
-2
tests/test_modeling_albert.py
tests/test_modeling_albert.py
+1
-1
tests/test_modeling_auto.py
tests/test_modeling_auto.py
+1
-2
tests/test_modeling_bart.py
tests/test_modeling_bart.py
+1
-1
tests/test_modeling_bert.py
tests/test_modeling_bert.py
+1
-1
tests/test_modeling_camembert.py
tests/test_modeling_camembert.py
+1
-2
tests/test_modeling_common.py
tests/test_modeling_common.py
+1
-2
tests/test_modeling_ctrl.py
tests/test_modeling_ctrl.py
+1
-1
tests/test_modeling_distilbert.py
tests/test_modeling_distilbert.py
+1
-1
tests/test_modeling_electra.py
tests/test_modeling_electra.py
+1
-1
tests/test_modeling_encoder_decoder.py
tests/test_modeling_encoder_decoder.py
+1
-1
tests/test_modeling_flaubert.py
tests/test_modeling_flaubert.py
+1
-1
tests/test_modeling_gpt2.py
tests/test_modeling_gpt2.py
+1
-1
No files found.
examples/seq2seq/finetune_bart_tiny.sh
View file @
13deb95a
...
...
@@ -12,7 +12,7 @@ export OUTPUT_DIR=${CURRENT_DIR}/${OUTPUT_DIR_NAME}
# Make output directory if it doesn't exist
mkdir
-p
$OUTPUT_DIR
# Add parent directory to python path to access lightning_base.py and utils.py
# Add parent directory to python path to access lightning_base.py and
testing_
utils.py
export
PYTHONPATH
=
"../"
:
"
${
PYTHONPATH
}
"
python finetune.py
\
--data_dir
=
cnn_tiny/
\
...
...
examples/seq2seq/test_seq2seq_examples.py
View file @
13deb95a
...
...
@@ -12,6 +12,7 @@ import torch
from
torch.utils.data
import
DataLoader
from
transformers
import
AutoTokenizer
from
transformers.testing_utils
import
require_multigpu
from
.distillation
import
distill_main
,
evaluate_checkpoint
from
.finetune
import
main
...
...
@@ -107,7 +108,7 @@ class TestSummarizationDistiller(unittest.TestCase):
logging
.
disable
(
logging
.
CRITICAL
)
# remove noisy download output from tracebacks
return
cls
@
unittest
.
skipUnless
(
torch
.
cuda
.
device_count
()
>
1
,
"skipping multiGPU test"
)
@
require_multigpu
def
test_multigpu
(
self
):
updates
=
dict
(
no_teacher
=
True
,
freeze_encoder
=
True
,
gpus
=
2
,
sortish_sampler
=
False
,)
self
.
_test_distiller_cli
(
updates
)
...
...
tests/
utils.py
→
src/transformers/testing_
utils.py
View file @
13deb95a
File moved
tests/test_activations.py
View file @
13deb95a
import
unittest
from
transformers
import
is_torch_available
from
.utils
import
require_torch
from
transformers.testing_utils
import
require_torch
if
is_torch_available
():
...
...
tests/test_benchmark.py
View file @
13deb95a
...
...
@@ -4,8 +4,7 @@ import unittest
from
pathlib
import
Path
from
transformers
import
AutoConfig
,
is_torch_available
from
.utils
import
require_torch
,
torch_device
from
transformers.testing_utils
import
require_torch
,
torch_device
if
is_torch_available
():
...
...
tests/test_benchmark_tf.py
View file @
13deb95a
...
...
@@ -4,8 +4,7 @@ import unittest
from
pathlib
import
Path
from
transformers
import
AutoConfig
,
is_tf_available
from
.utils
import
require_tf
from
transformers.testing_utils
import
require_tf
if
is_tf_available
():
...
...
tests/test_configuration_auto.py
View file @
13deb95a
...
...
@@ -19,8 +19,7 @@ import unittest
from
transformers.configuration_auto
import
CONFIG_MAPPING
,
AutoConfig
from
transformers.configuration_bert
import
BertConfig
from
transformers.configuration_roberta
import
RobertaConfig
from
.utils
import
DUMMY_UNKWOWN_IDENTIFIER
from
transformers.testing_utils
import
DUMMY_UNKWOWN_IDENTIFIER
SAMPLE_ROBERTA_CONFIG
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"fixtures/dummy-config.json"
)
...
...
tests/test_doc_samples.py
View file @
13deb95a
...
...
@@ -21,8 +21,7 @@ from pathlib import Path
from
typing
import
List
,
Union
import
transformers
from
.utils
import
require_tf
,
require_torch
,
slow
from
transformers.testing_utils
import
require_tf
,
require_torch
,
slow
logger
=
logging
.
getLogger
()
...
...
tests/test_modeling_albert.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_auto.py
View file @
13deb95a
...
...
@@ -17,8 +17,7 @@
import
unittest
from
transformers
import
is_torch_available
from
.utils
import
DUMMY_UNKWOWN_IDENTIFIER
,
SMALL_MODEL_IDENTIFIER
,
require_torch
,
slow
from
transformers.testing_utils
import
DUMMY_UNKWOWN_IDENTIFIER
,
SMALL_MODEL_IDENTIFIER
,
require_torch
,
slow
if
is_torch_available
():
...
...
tests/test_modeling_bart.py
View file @
13deb95a
...
...
@@ -20,10 +20,10 @@ import timeout_decorator # noqa
from
transformers
import
is_torch_available
from
transformers.file_utils
import
cached_property
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_bert.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
floats_tensor
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_camembert.py
View file @
13deb95a
...
...
@@ -16,8 +16,7 @@
import
unittest
from
transformers
import
is_torch_available
from
.utils
import
require_torch
,
slow
,
torch_device
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_common.py
View file @
13deb95a
...
...
@@ -21,8 +21,7 @@ import unittest
from
typing
import
List
from
transformers
import
is_torch_available
from
.utils
import
require_multigpu
,
require_torch
,
slow
,
torch_device
from
transformers.testing_utils
import
require_multigpu
,
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_ctrl.py
View file @
13deb95a
...
...
@@ -16,10 +16,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_distilbert.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_electra.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_encoder_decoder.py
View file @
13deb95a
...
...
@@ -18,12 +18,12 @@ import tempfile
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
# TODO(PVP): this line reruns all the tests in BertModelTest; not sure whether this can be prevented
# for now only run module with pytest tests/test_modeling_encoder_decoder.py::EncoderDecoderModelTest
from
.test_modeling_bert
import
BertModelTester
from
.test_modeling_common
import
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_flaubert.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
tests/test_modeling_gpt2.py
View file @
13deb95a
...
...
@@ -17,10 +17,10 @@
import
unittest
from
transformers
import
is_torch_available
from
transformers.testing_utils
import
require_torch
,
slow
,
torch_device
from
.test_configuration_common
import
ConfigTester
from
.test_modeling_common
import
ModelTesterMixin
,
ids_tensor
from
.utils
import
require_torch
,
slow
,
torch_device
if
is_torch_available
():
...
...
Prev
1
2
3
4
Next
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