Update quality tooling for formatting (#21480)
* Result of black 23.1 * Update target to Python 3.7 * Switch flake8 to ruff * Configure isort * Configure isort * Apply isort with line limit * Put the right black version * adapt black in check copies * Fix copies
This commit is contained in:
@@ -96,7 +96,6 @@ class Wav2Vec2FeatureExtractionTester(unittest.TestCase):
|
||||
|
||||
|
||||
class Wav2Vec2FeatureExtractionTest(SequenceFeatureExtractionTestMixin, unittest.TestCase):
|
||||
|
||||
feature_extraction_class = Wav2Vec2FeatureExtractor
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -45,6 +45,7 @@ if is_flax_available():
|
||||
import jax.numpy as jnp
|
||||
import optax
|
||||
from flax.traverse_util import flatten_dict
|
||||
|
||||
from transformers import Wav2Vec2FeatureExtractor, Wav2Vec2Processor
|
||||
from transformers.models.wav2vec2.modeling_flax_wav2vec2 import (
|
||||
FlaxWav2Vec2ForCTC,
|
||||
@@ -58,6 +59,7 @@ if is_flax_available():
|
||||
|
||||
if is_pyctcdecode_available():
|
||||
import pyctcdecode.decoder
|
||||
|
||||
from transformers import Wav2Vec2ProcessorWithLM
|
||||
from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
|
||||
|
||||
@@ -67,7 +69,6 @@ if is_librosa_available():
|
||||
|
||||
|
||||
def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
|
||||
|
||||
error = None
|
||||
try:
|
||||
_ = in_queue.get(timeout=timeout)
|
||||
@@ -276,7 +277,6 @@ class FlaxWav2Vec2ModelTest(FlaxModelTesterMixin, unittest.TestCase):
|
||||
|
||||
self.assertEqual(len(outputs), len(jitted_outputs))
|
||||
for jitted_output, output in zip(jitted_outputs, outputs):
|
||||
|
||||
self.assertEqual(jitted_output.shape, output.shape)
|
||||
|
||||
def test_freeze_feature_encoder(self):
|
||||
|
||||
@@ -26,8 +26,8 @@ import unittest
|
||||
import numpy as np
|
||||
import pytest
|
||||
from datasets import load_dataset
|
||||
|
||||
from huggingface_hub import snapshot_download
|
||||
|
||||
from transformers import Wav2Vec2Config, is_tf_available
|
||||
from transformers.testing_utils import (
|
||||
CaptureLogger,
|
||||
@@ -53,6 +53,7 @@ if is_tf_available():
|
||||
|
||||
if is_pyctcdecode_available():
|
||||
import pyctcdecode.decoder
|
||||
|
||||
from transformers import Wav2Vec2ProcessorWithLM
|
||||
from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
|
||||
|
||||
@@ -62,7 +63,6 @@ if is_librosa_available():
|
||||
|
||||
|
||||
def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
|
||||
|
||||
error = None
|
||||
try:
|
||||
_ = in_queue.get(timeout=timeout)
|
||||
@@ -283,7 +283,6 @@ class TFWav2Vec2ModelTester:
|
||||
|
||||
@require_tf
|
||||
class TFWav2Vec2ModelTest(TFModelTesterMixin, unittest.TestCase):
|
||||
|
||||
all_model_classes = (TFWav2Vec2Model, TFWav2Vec2ForCTC) if is_tf_available() else ()
|
||||
test_resize_embeddings = False
|
||||
test_head_masking = False
|
||||
|
||||
@@ -81,6 +81,7 @@ if is_torchaudio_available():
|
||||
|
||||
if is_pyctcdecode_available():
|
||||
import pyctcdecode.decoder
|
||||
|
||||
from transformers import Wav2Vec2ProcessorWithLM
|
||||
from transformers.models.wav2vec2_with_lm import processing_wav2vec2_with_lm
|
||||
|
||||
@@ -90,7 +91,6 @@ if is_torch_fx_available():
|
||||
|
||||
|
||||
def _test_wav2vec2_with_lm_invalid_pool(in_queue, out_queue, timeout):
|
||||
|
||||
error = None
|
||||
try:
|
||||
_ = in_queue.get(timeout=timeout)
|
||||
|
||||
Reference in New Issue
Block a user