Spaces:
Paused
Paused
Update README.md
Browse files
README.md
CHANGED
|
@@ -46,13 +46,33 @@ because it only emits what the audio actually supports.
|
|
| 46 |
|
| 47 |
Throughput on an M-series Mac: roughly **8× realtime** for `tiny.en`.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
## Hardware
|
| 50 |
|
| 51 |
-
Designed for **`cpu-basic`**
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
`suggested_hardware` above only advises people who *duplicate* this
|
| 58 |
Space. The tier this Space actually runs on is a repository setting —
|
|
@@ -84,4 +104,4 @@ sidepage serve <name> --anon # ...and gives you a public URL
|
|
| 84 |
Use the standard `openai/*` repos, not the pre-converted
|
| 85 |
`mlx-community/whisper-*-mlx` ones: mlx-audio converts the weights itself
|
| 86 |
on load and needs the Hugging Face processor files, which those repos
|
| 87 |
-
don't ship. Loading one fails with *"Processor not found."*
|
|
|
|
| 46 |
|
| 47 |
Throughput on an M-series Mac: roughly **8× realtime** for `tiny.en`.
|
| 48 |
|
| 49 |
+
### MLX and Gradio: all model work runs on one thread
|
| 50 |
+
|
| 51 |
+
Worth knowing if you adapt this app. **MLX streams are thread-local**, and
|
| 52 |
+
an array created under one thread's stream can't be used from another —
|
| 53 |
+
it raises `RuntimeError: There is no Stream(gpu, 0) in current thread.`
|
| 54 |
+
Gradio runs event handlers in anyio's worker pool, which hands out
|
| 55 |
+
different threads over time, so a model loaded at import and used
|
| 56 |
+
directly from a handler fails on essentially every chunk.
|
| 57 |
+
|
| 58 |
+
Two fixes that look right and aren't: wrapping the call in
|
| 59 |
+
`mx.stream(<stream captured on the main thread>)`, and calling
|
| 60 |
+
`mx.set_default_device(mx.gpu)` inside the worker. Both still raise — the
|
| 61 |
+
stream can't be adopted by another thread at all. What works is keeping
|
| 62 |
+
every MLX call on one consistent thread, here a single-worker
|
| 63 |
+
`ThreadPoolExecutor`. That also serializes `stream` against
|
| 64 |
+
`stop_recording`, which are separate Gradio events and could otherwise
|
| 65 |
+
touch the same decoder concurrently.
|
| 66 |
+
|
| 67 |
## Hardware
|
| 68 |
|
| 69 |
+
Designed for **`cpu-basic`**, which is all it needs — the model runs on
|
| 70 |
+
MLX, not CUDA.
|
| 71 |
+
|
| 72 |
+
Setting a Space to ZeroGPU (`zero-a10g`) when it doesn't need one is
|
| 73 |
+
still worth avoiding: it costs GPU quota, and tools that read the tier
|
| 74 |
+
will treat the Space as GPU-dependent even though `@spaces.GPU` is inert
|
| 75 |
+
outside Hugging Face and the app would run fine on CPU elsewhere.
|
| 76 |
|
| 77 |
`suggested_hardware` above only advises people who *duplicate* this
|
| 78 |
Space. The tier this Space actually runs on is a repository setting —
|
|
|
|
| 104 |
Use the standard `openai/*` repos, not the pre-converted
|
| 105 |
`mlx-community/whisper-*-mlx` ones: mlx-audio converts the weights itself
|
| 106 |
on load and needs the Hugging Face processor files, which those repos
|
| 107 |
+
don't ship. Loading one fails with *"Processor not found."*
|