[Seamless v2] Add FE to auto mapping (#27829)

This commit is contained in:
Sanchit Gandhi
2023-12-04 16:34:13 +00:00
committed by GitHub
parent 1d63b0ec36
commit 3c15fd1990
2 changed files with 18 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ FEATURE_EXTRACTOR_MAPPING_NAMES = OrderedDict(
("regnet", "ConvNextFeatureExtractor"), ("regnet", "ConvNextFeatureExtractor"),
("resnet", "ConvNextFeatureExtractor"), ("resnet", "ConvNextFeatureExtractor"),
("seamless_m4t", "SeamlessM4TFeatureExtractor"), ("seamless_m4t", "SeamlessM4TFeatureExtractor"),
("seamless_m4t_v2", "SeamlessM4TFeatureExtractor"),
("segformer", "SegformerFeatureExtractor"), ("segformer", "SegformerFeatureExtractor"),
("sew", "Wav2Vec2FeatureExtractor"), ("sew", "Wav2Vec2FeatureExtractor"),
("sew-d", "Wav2Vec2FeatureExtractor"), ("sew-d", "Wav2Vec2FeatureExtractor"),

View File

@@ -1115,6 +1115,23 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase):
assert result == EXPECTED_RESULT assert result == EXPECTED_RESULT
@require_torch
@slow
def test_seamless_v2(self):
pipe = pipeline(
"automatic-speech-recognition",
model="facebook/seamless-m4t-v2-large",
device="cuda:0",
)
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
sample = dataset[0]["audio"]
result = pipe(sample, generate_kwargs={"tgt_lang": "eng"})
EXPECTED_RESULT = "mister quilter is the apostle of the middle classes and we are glad to welcome his gospel"
assert result["text"] == EXPECTED_RESULT
@require_torch @require_torch
@slow @slow
def test_chunking_and_timestamps(self): def test_chunking_and_timestamps(self):