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
2adc8c92
Unverified
Commit
2adc8c92
authored
Mar 11, 2021
by
Lysandre Debut
Committed by
GitHub
Mar 11, 2021
Browse files
W2v2 test require torch (#10665)
* Adds a @require_torch to a test that requires it * Tokenizer too * Style
parent
055ed78f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
tests/test_feature_extraction_wav2vec2.py
tests/test_feature_extraction_wav2vec2.py
+2
-1
tests/test_tokenization_wav2vec2.py
tests/test_tokenization_wav2vec2.py
+2
-1
No files found.
tests/test_feature_extraction_wav2vec2.py
View file @
2adc8c92
...
@@ -21,7 +21,7 @@ import unittest
...
@@ -21,7 +21,7 @@ import unittest
import
numpy
as
np
import
numpy
as
np
from
transformers
import
WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST
,
Wav2Vec2Config
,
Wav2Vec2FeatureExtractor
from
transformers
import
WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST
,
Wav2Vec2Config
,
Wav2Vec2FeatureExtractor
from
transformers.testing_utils
import
slow
from
transformers.testing_utils
import
require_torch
,
slow
from
.test_sequence_feature_extraction_common
import
SequenceFeatureExtractionTestMixin
from
.test_sequence_feature_extraction_common
import
SequenceFeatureExtractionTestMixin
...
@@ -134,6 +134,7 @@ class Wav2Vec2FeatureExtractionTest(SequenceFeatureExtractionTestMixin, unittest
...
@@ -134,6 +134,7 @@ class Wav2Vec2FeatureExtractionTest(SequenceFeatureExtractionTestMixin, unittest
_check_zero_mean_unit_variance
(
input_values
[
2
])
_check_zero_mean_unit_variance
(
input_values
[
2
])
@
slow
@
slow
@
require_torch
def
test_pretrained_checkpoints_are_set_correctly
(
self
):
def
test_pretrained_checkpoints_are_set_correctly
(
self
):
# this test makes sure that models that are using
# this test makes sure that models that are using
# group norm don't have their feature extractor return the
# group norm don't have their feature extractor return the
...
...
tests/test_tokenization_wav2vec2.py
View file @
2adc8c92
...
@@ -30,7 +30,7 @@ from transformers import (
...
@@ -30,7 +30,7 @@ from transformers import (
Wav2Vec2Tokenizer
,
Wav2Vec2Tokenizer
,
)
)
from
transformers.models.wav2vec2.tokenization_wav2vec2
import
VOCAB_FILES_NAMES
from
transformers.models.wav2vec2.tokenization_wav2vec2
import
VOCAB_FILES_NAMES
from
transformers.testing_utils
import
slow
from
transformers.testing_utils
import
require_torch
,
slow
from
.test_tokenization_common
import
TokenizerTesterMixin
from
.test_tokenization_common
import
TokenizerTesterMixin
...
@@ -340,6 +340,7 @@ class Wav2Vec2TokenizerTest(unittest.TestCase):
...
@@ -340,6 +340,7 @@ class Wav2Vec2TokenizerTest(unittest.TestCase):
self
.
assertListEqual
(
processed
.
attention_mask
.
sum
(
-
1
).
tolist
(),
[
800
,
1000
,
1200
])
self
.
assertListEqual
(
processed
.
attention_mask
.
sum
(
-
1
).
tolist
(),
[
800
,
1000
,
1200
])
@
slow
@
slow
@
require_torch
def
test_pretrained_checkpoints_are_set_correctly
(
self
):
def
test_pretrained_checkpoints_are_set_correctly
(
self
):
# this test makes sure that models that are using
# this test makes sure that models that are using
# group norm don't have their tokenizer return the
# group norm don't have their tokenizer return the
...
...
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