From 783d03b46fd7bed1ef7b1e40e477134f19b82edc Mon Sep 17 00:00:00 2001 From: 3manifold <22544721+3manifold@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:21:05 +0100 Subject: [PATCH 1/4] Revoke cpu_threads in test_transformers_wav2vec2 similar to test_transformers_wav2vec2bert --- python/tests/test_transformers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_transformers.py b/python/tests/test_transformers.py index 77fa4f63e..4cdd059ae 100644 --- a/python/tests/test_transformers.py +++ b/python/tests/test_transformers.py @@ -1011,13 +1011,13 @@ def test_transformers_wav2vec2( ) device = "cuda" if os.environ.get("CUDA_VISIBLE_DEVICES") else "cpu" - # cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) + cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) model = ctranslate2.models.Wav2Vec2( output_dir, device=device, device_index=[0], compute_type="int8", - intra_threads=1, + intra_threads=cpu_threads, inter_threads=1, ) From 7120640e345983c1f43533179db076e57086b9dd Mon Sep 17 00:00:00 2001 From: 3manifold <22544721+3manifold@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:57:08 +0100 Subject: [PATCH 2/4] Revert "Revoke cpu_threads in test_transformers_wav2vec2 similar to test_transformers_wav2vec2bert" This reverts commit f7c71bd3c5d6834adf69daef33dd62eecb8563ae. --- python/tests/test_transformers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_transformers.py b/python/tests/test_transformers.py index 4cdd059ae..77fa4f63e 100644 --- a/python/tests/test_transformers.py +++ b/python/tests/test_transformers.py @@ -1011,13 +1011,13 @@ def test_transformers_wav2vec2( ) device = "cuda" if os.environ.get("CUDA_VISIBLE_DEVICES") else "cpu" - cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) + # cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) model = ctranslate2.models.Wav2Vec2( output_dir, device=device, device_index=[0], compute_type="int8", - intra_threads=cpu_threads, + intra_threads=1, inter_threads=1, ) From 50a74ceef49aab7f31443d30396c582ed676c53d Mon Sep 17 00:00:00 2001 From: 3manifold <22544721+3manifold@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:58:11 +0100 Subject: [PATCH 3/4] Set intra_threads=1 for test_transformers_wav2vec2bert as well --- python/tests/test_transformers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_transformers.py b/python/tests/test_transformers.py index 77fa4f63e..48c163b31 100644 --- a/python/tests/test_transformers.py +++ b/python/tests/test_transformers.py @@ -1091,13 +1091,13 @@ def test_transformers_wav2vec2bert( ) device = "cuda" if os.environ.get("CUDA_VISIBLE_DEVICES") else "cpu" - cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) + # cpu_threads = int(os.environ.get("OMP_NUM_THREADS", 0)) model = ctranslate2.models.Wav2Vec2Bert( output_dir, device=device, device_index=[0], compute_type="int8", - intra_threads=cpu_threads, + intra_threads=1, inter_threads=1, ) From 664458a2523a2562b5c9898c2dc4e73473f5397e Mon Sep 17 00:00:00 2001 From: 3manifold <22544721+3manifold@users.noreply.github.com> Date: Thu, 5 Feb 2026 10:17:23 +0100 Subject: [PATCH 4/4] Check for both "APOSSTEL" and "APOSSEL" in test_transformers_wav2vec2 --- python/tests/test_transformers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/tests/test_transformers.py b/python/tests/test_transformers.py index 48c163b31..a85330b2e 100644 --- a/python/tests/test_transformers.py +++ b/python/tests/test_transformers.py @@ -977,13 +977,15 @@ def teardown_class(cls): @test_utils.only_on_linux @test_utils.on_available_devices @pytest.mark.parametrize( - "model_name,expected_transcription", + "model_name,expected_transcriptions", [ ( "facebook/wav2vec2-large-robust-ft-swbd-300h", [ "MISTER QUILTER IS THE APOSSEL OF THE MIDDLE CLASSES AND" " WE ARE GLAD TO WELCOME HIS GOSPEL", + "MISTER QUILTER IS THE APOSSTEL OF THE MIDDLE CLASSES AND" + " WE ARE GLAD TO WELCOME HIS GOSPEL", ], ), ], @@ -993,7 +995,7 @@ def test_transformers_wav2vec2( tmp_dir, device, model_name, - expected_transcription, + expected_transcriptions, ): import torch import transformers @@ -1046,7 +1048,7 @@ def test_transformers_wav2vec2( transcription = processor.decode(predicted_ids, output_word_offsets=True) transcription = transcription[0].replace(processor.tokenizer.unk_token, "") - assert transcription == expected_transcription[0] + assert transcription in expected_transcriptions class TestWav2Vec2Bert: