Mercurial
comparison dictation/transcriber.py @ 282:6bd4a3990696 default tip
Add cross-platform canvas orchestration and typed composer
Enable native ARM dependencies, macOS Copilot orchestration, portable service supervision, CPU dictation, and a shared N-key speak-or-type composer.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 20 Aug 2026 20:45:25 -0700 |
| parents | 49e9e591c9bb |
| children |
comparison
equal
deleted
inserted
replaced
| 281:c57149ad216e | 282:6bd4a3990696 |
|---|---|
| 28 ) -> Transcript: | 28 ) -> Transcript: |
| 29 ... | 29 ... |
| 30 | 30 |
| 31 | 31 |
| 32 class FasterWhisperTranscriber: | 32 class FasterWhisperTranscriber: |
| 33 def __init__(self, model_dir: Path, compute_type: str) -> None: | 33 def __init__( |
| 34 self, | |
| 35 model_dir: Path, | |
| 36 device: str, | |
| 37 compute_type: str, | |
| 38 ) -> None: | |
| 34 self._model_dir = model_dir | 39 self._model_dir = model_dir |
| 40 self._device = device | |
| 35 self._compute_type = compute_type | 41 self._compute_type = compute_type |
| 36 self._executor = ThreadPoolExecutor( | 42 self._executor = ThreadPoolExecutor( |
| 37 max_workers=1, | 43 max_workers=1, |
| 38 thread_name_prefix="dictation", | 44 thread_name_prefix="dictation", |
| 39 ) | 45 ) |
| 60 f"Model not found at {self._model_dir}. " | 66 f"Model not found at {self._model_dir}. " |
| 61 "Run: bazel run //dictation:download_model" | 67 "Run: bazel run //dictation:download_model" |
| 62 ) | 68 ) |
| 63 model = WhisperModel( | 69 model = WhisperModel( |
| 64 str(self._model_dir), | 70 str(self._model_dir), |
| 65 device="cuda", | 71 device=self._device, |
| 66 compute_type=self._compute_type, | 72 compute_type=self._compute_type, |
| 67 local_files_only=True, | 73 local_files_only=True, |
| 68 ) | 74 ) |
| 69 # Loading weights does not initialize all CUDA kernels. Execute and | 75 # Loading weights does not initialize all CUDA kernels. Execute and |
| 70 # consume one short silent inference now so the user's first utterance | 76 # consume one short silent inference now so the user's first utterance |