Skip to content

Commit 4a18206

Browse files
committed
Revert "Enhance MLX batch_size functionality and documentation"
This reverts commit 8b72232.
1 parent 8b72232 commit 4a18206

File tree

3 files changed

+2
-73
lines changed

3 files changed

+2
-73
lines changed

README.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ Over 700+⭐'s because this program this app just works! Works great for windows
1515

1616
### New in 3.1!
1717

18-
Mac acceleration option using the new [lightning-whisper-mlx](https://github.com/mustafaaljadery/lightning-whisper-mlx) backend. Enable with `--device mlx`. Now supports multiple languages, custom vocabulary via `--initial_prompt`, both transcribe/translate tasks, and **batch processing** for improved throughput. 10x faster than Whisper CPP, 4x faster than previous MLX implementations!
19-
20-
**Batch Processing:** MLX backend supports `--batch_size` parameter (default: 12) for improved throughput. Higher batch sizes provide better performance but require more memory.
18+
Mac acceleration option using the new [lightning-whisper-mlx](https://github.com/mustafaaljadery/lightning-whisper-mlx) backend. Enable with `--device mlx`. Now supports multiple languages, custom vocabulary via `--initial_prompt`, and both transcribe/translate tasks. 10x faster than Whisper CPP, 4x faster than previous MLX implementations!
2119

2220
**Model Storage:** MLX models are now stored in `~/.cache/whisper/mlx_models/` for consistency with other backends, instead of cluttering your current working directory.
2321

@@ -57,8 +55,6 @@ transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane
5755
transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane --task translate
5856
# Mac accelerated back-end
5957
transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device mlx
60-
# Mac accelerated with custom batch size for better throughput
61-
transcribe-anything video.mp4 --device mlx --batch_size 24
6258
# Use custom prompt for better recognition of specific terms
6359
transcribe-anything video.mp4 --initial_prompt "The speaker discusses AI, machine learning, and neural networks."
6460
# Load prompt from file
@@ -178,27 +174,6 @@ Mac:
178174

179175
- Use `--device mlx`
180176

181-
#### MLX Batch Processing
182-
183-
The MLX backend supports batch processing for improved throughput on Apple Silicon:
184-
185-
```bash
186-
# Default batch size (12)
187-
transcribe-anything video.mp4 --device mlx
188-
189-
# Custom batch size for better performance
190-
transcribe-anything video.mp4 --device mlx --batch_size 24
191-
192-
# Lower batch size for memory-constrained systems
193-
transcribe-anything video.mp4 --device mlx --batch_size 6
194-
```
195-
196-
**Batch Size Guidelines:**
197-
- Default: 12 (good balance of speed and memory usage)
198-
- Higher values (16-24): Better throughput but require more unified memory
199-
- Lower values (4-8): Use if experiencing memory issues
200-
- The optimal batch size depends on your model size and available unified memory
201-
202177
# Custom Prompts and Vocabulary
203178

204179
Whisper supports custom prompts to improve transcription accuracy for domain-specific vocabulary, names, or technical terms. This is especially useful when transcribing content with:

src/transcribe_anything/whisper_mac.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ def run_whisper_mac_mlx( # pylint: disable=too-many-arguments
233233
word_timestamps = parsed_args.get("word_timestamps", False)
234234
verbose = parsed_args.get("verbose", False)
235235
temperature = parsed_args.get("temperature", 0.0)
236-
task_param = parsed_args.get("task", task) # Use parsed task or fallback to function parameter
237236

238237
# Get the environment and run transcription
239238
env = get_environment()
@@ -292,12 +291,8 @@ def run_whisper_mac_mlx( # pylint: disable=too-many-arguments
292291
audio="{input_wav_abs}",
293292
path_or_hf_repo=str(model_dir),
294293
language={repr(parsed_args.get("language"))},
295-
task={repr(task_param)},
296294
batch_size={batch_size},
297-
initial_prompt={repr(initial_prompt)},
298-
word_timestamps={repr(word_timestamps)},
299-
verbose={repr(verbose)},
300-
temperature={repr(temperature)}
295+
initial_prompt={repr(initial_prompt)}
301296
)
302297
303298
# Print the result as JSON

tests/test_insanely_fast_whisper_mlx.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -101,47 +101,6 @@ def test_multilingual_support(self) -> None:
101101
self.assertTrue((test_dir / "out.srt").exists())
102102
self.assertTrue((test_dir / "out.json").exists())
103103

104-
@unittest.skipUnless(CAN_RUN_TEST, "Not mac")
105-
def test_batch_size_functionality(self) -> None:
106-
"""Check that batch_size parameter works correctly."""
107-
test_dir = LOCALFILE_DIR / "text_video_batch_size"
108-
shutil.rmtree(test_dir, ignore_errors=True)
109-
110-
# Test with custom batch_size
111-
run_whisper_mac_mlx(
112-
input_wav=TEST_WAV,
113-
model="small",
114-
output_dir=test_dir,
115-
language="en",
116-
task="transcribe",
117-
other_args=["--batch_size", "6"] # Custom batch size
118-
)
119-
120-
# Verify output files were created
121-
self.assertTrue((test_dir / "out.txt").exists())
122-
self.assertTrue((test_dir / "out.srt").exists())
123-
self.assertTrue((test_dir / "out.json").exists())
124-
self.assertTrue((test_dir / "out.vtt").exists())
125-
126-
@unittest.skipUnless(CAN_RUN_TEST, "Not mac")
127-
def test_batch_size_parsing(self) -> None:
128-
"""Check that batch_size argument parsing works correctly."""
129-
from transcribe_anything.whisper_mac import _parse_other_args
130-
131-
# Test valid batch_size
132-
result = _parse_other_args(["--batch_size", "24"])
133-
self.assertEqual(result["batch_size"], 24)
134-
135-
# Test with other arguments
136-
result = _parse_other_args(["--language", "en", "--batch_size", "8", "--verbose"])
137-
self.assertEqual(result["batch_size"], 8)
138-
self.assertEqual(result["language"], "en")
139-
self.assertTrue(result["verbose"])
140-
141-
# Test invalid batch_size (should not crash, just use default)
142-
result = _parse_other_args(["--batch_size", "invalid"])
143-
self.assertNotIn("batch_size", result) # Should be filtered out due to ValueError
144-
145104

146105
if __name__ == "__main__":
147106
unittest.main()

0 commit comments

Comments
 (0)