Skip to content

Add custom GGUF speech models for dictation and FluidMeet - #1456

Open
orhanveli wants to merge 12 commits into
altic-dev:mainfrom
orhanveli:feat/custom-speech-models
Open

orhanveli wants to merge 12 commits into
altic-dev:mainfrom
orhanveli:feat/custom-speech-models

Conversation

@orhanveli

@orhanveli orhanveli commented Nov 30, 2026 •

Copy link
Copy Markdown

Description

Adds custom GGUF speech models that run through the bundled transcribe.cpp, so users can bring a model for a language, dialect or vocabulary the built-in engines don't cover.

  • Settings > Voice Engine gets a Custom Models section: add a model from a local .gguf file or from Hugging Face (owner/repo or a huggingface.co repo, tree, resolve or blob link), use it, remove it, or recover a missing or damaged file by downloading it again or choosing it again.
  • A custom model works as the voice engine for dictation and file transcription. selectedVoiceEngineID keys every "same model, keep it loaded" decision, so switching between two custom models loads the new one.
  • FluidMeet freezes the selected custom model into the attempt when it supports the meeting language with word timings. Otherwise meetings use Parakeet for its languages, then the first installed custom model that can handle the language. The meeting language picker and retranscription choices add the languages of installed custom models with word timings.
  • CustomGGUFProvider binds to one model entry, requests token or word timestamps when the model has them, and splits audio longer than the model's declared limit into consecutive runs with word timings shifted back.
  • Languages, timestamp granularity and the audio-length limit come from the GGUF at import. Files live in Application Support, which macOS doesn't purge.
  • The Hugging Face parser rejects other hosts, http, credentials, ports and dot segments before sending any request.
  • Removing the active custom model returns to the previous built-in engine and only loads it when it's installed, so removal never starts a download.
  • Built-in engines and their meeting fingerprints don't change. Saved meetings accept any catalog language, so a meeting stays readable and keeps its language label after its custom model is removed.

Speaker attribution needs per-word timings. transcribe.cpp's Whisper architecture only returns segment timings, so a Whisper GGUF works for dictation while meetings fall back to Parakeet; Parakeet-architecture GGUFs return token timings and work for both.

Type of Change

  • 🐞 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 🧹 Chore
  • 📝 Documentation update

Related Issue or Discussion

Closes #1455

Discussion: #1454 (maintainer acceptance pending). Related request: #1279.

Testing

Environment: FluidVoice 1.6.13 built from this branch, macOS 27.2.1, Apple Silicon (arm64).

  • Unit tests: 69 tests across CustomSpeechModelSettingsTests, CustomSpeechModelLibraryTests, CustomGGUFProviderTests, CustomSpeechModelASRServiceTests, HuggingFaceGGUFReferenceTests, CustomSpeechModelsControllerTests, CustomSpeechModelMeetingTests, CustomSpeechModelMeetingLanguageTests and CustomSpeechModelReviewFixTests pass (1 skipped: the real-model test needs FLUID_CUSTOM_GGUF_TEST_MODEL and FLUID_CUSTOM_GGUF_TEST_AUDIO).

  • Meeting suites: MeetingSessionModelTests, SpeakerTurnMergingTests and MeetingParakeetNemotronBackendTests pass except testHostBindsRuntimeFactoryToTheFrozenRequest, which reads the custom dictionary from the machine's UserDefaults and fails on any machine with dictionary entries. This branch doesn't change that test.

  • Tests/run_meeting_model_policy_tests.py: 303 checks pass. Tests/run_meeting_computer_audio_tests.py: 33 checks pass.

  • Real model: velifurkan/parakeet-tdt-0.6b-tr-gguf (Q8_0, 0.73 GB, CC BY 4.0) runs on the bundled transcribe.cpp with Metal and returns accurate Turkish text with word timings.

  • Not run yet: end-to-end checks in the app (Hugging Face download from Settings, Turkish dictation, a two-speaker Turkish meeting, switching between two custom models, missing-file recovery), Intel Mac, and any Whisper GGUF.

  • Tested on Intel Mac

  • Tested on Apple Silicon Mac

  • Tested on macOS version: 27.2.1

  • Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources Tests Package.swift (SwiftLint 0.63.2, the CI version)

  • Ran formatter locally: swiftformat --config .swiftformat Sources (SwiftFormat 0.61.1, the CI version)

  • Ran tests locally: see above

Screenshots / Video

Screenshot 2026-11-30 at 16 32 49

Downloaded model, it's ready to use

Screenshot 2026-11-30 at 16 57 49

Add CustomSpeechModel, the SpeechModel.customGGUF case, the stored list
and selected entry, and selectedVoiceEngineID so two custom models are
never treated as the same engine.
Store files in Application Support (not Caches, which macOS may purge),
read capabilities from the GGUF at import, report missing or damaged
files, and restore a file into an existing entry.
CustomGGUFProvider is bound to one entry, requests token or word
timestamps when the model has them, and fails prepare with a message
naming the model when its file is missing or damaged.
Route .customGGUF to a provider bound to the selected entry and key every
"same model, keep it loaded" decision on selectedVoiceEngineID, so
switching between two custom models always loads the new one. A missing
custom file reads as not installed.
Accept owner/repo ids and huggingface.co repo, tree, resolve and blob
links; reject other hosts, http, credentials, ports and dot segments
before any request. Downloads go through the library's GGUF check.
Add a Custom Models section to Settings > Voice Engine: add a GGUF from
disk or Hugging Face, use, remove, and recover a missing or damaged file
by re-downloading or choosing it again. Selecting, removing or restoring
the active model reloads the engine through the same path as built-in
activation.
When the selected voice engine is a custom GGUF model that supports the
meeting language with word timings, freeze it into the attempt and run
it through CustomGGUFProvider; otherwise keep Parakeet. Saved meetings
accept any catalog language so removing a model never makes them
unreadable. Built-in fingerprints are unchanged.
The meeting language picker and retranscription choices list Parakeet's
languages plus those of installed custom models with word timings.
Language names resolve from the catalog, so a meeting keeps its label
after its custom model is removed.
Meeting setup now accepts any catalog language because a custom voice
engine can supply it; codes outside the catalog are still rejected.
Update the computer-audio script stub for MeetingLanguageSupport.
- Meetings fall back to any installed custom model that handles the
  language with word timings when neither the selected engine nor
  Parakeet can, so offered languages always transcribe.
- Removing the active custom model returns to the previous built-in
  engine and only loads it when installed, never starting a download.
- Store each model's declared audio-length limit and split longer audio
  into consecutive runs, shifting word timings back.
…code

Format with the version CI pins and fix the strict SwiftLint findings in
the custom model downloader and tests.
@github-actions github-actions Bot added the needs screenshots Pull request needs screenshot or video evidence. label Nov 30, 2026
@github-actions

Copy link
Copy Markdown

The PR Policy check is blocking this PR because required template information is missing.

Please update the PR description with:

  • Screenshots / Video

Visual files detected:

  • Sources/Fluid/Persistence/SettingsStore.swift
  • Sources/Fluid/UI/AISettings/CustomSpeechModelsController.swift
  • Sources/Fluid/UI/AISettings/CustomSpeechModelsSection.swift
  • Sources/Fluid/UI/AISettings/VoiceEngineSettingsViewModel.swift
  • Sources/Fluid/UI/AISettingsView+SpeechRecognition.swift
  • Sources/Fluid/UI/MeetingRecordingSettingsSheet.swift

Screenshots or video are required for UI, UX, settings, onboarding, overlay, menu bar, or visual behavior changes. If this PR has no visual changes, check the no-visual-change box in the template.

If this remains incomplete for 48 hours after opening, the PR may be closed.

@github-actions github-actions Bot removed the needs screenshots Pull request needs screenshot or video evidence. label Nov 30, 2026
@orhanveli
orhanveli marked this pull request as ready for review November 30, 2026 14:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-30T14:17:00.583429Z
We couldn’t complete this review. Comment @codex review to try again.
812f00b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge, with one remaining non-blocking cancellation issue in model recovery.

Summary

Adds custom GGUF speech models for dictation, file transcription, and meetings.

  • Users can add and manage GGUF speech models in Voice Engine settings.
  • Selected custom models handle dictation and file transcription.
  • Meetings can use custom models that support their language with word timings.
  • Xcode registers the new custom speech model tests.

Reviews (2) · Last reviewed commit: "fix(models): address PR review of custom..." · Reviewed by Greptile

Comment on lines +141 to +144
func cancel() {
self.task?.cancel()
self.task = nil
self.operation = .idle

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cancelled downloads still change state

cancel reports idle and releases the task before its work stops. During model inspection, the detached install keeps running and importFile still saves the model after cancellation. During network cancellation, the old task's error can also overwrite a newly started operation through the unguarded catch blocks in perform.

Keep ownership until the old task finishes, check cancellation before placing files and saving entries, and guard progress and completion updates with an operation ID.

Prompt To Fix With AI
This is a comment left during a code review.
Path: Sources/Fluid/UI/AISettings/CustomSpeechModelsController.swift
Line: 141-144

Comment:
**Cancelled downloads still change state**

`cancel` reports idle and releases the task before its work stops. During model inspection, the detached `install` keeps running and `importFile` still saves the model after cancellation. During network cancellation, the old task's error can also overwrite a newly started operation through the unguarded catch blocks in `perform`.

Keep ownership until the old task finishes, check cancellation before placing files and saving entries, and guard progress and completion updates with an operation ID.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4f6561f:

  • cancel() now only cancels the running task and leaves ownership with it. The section stays busy until the work unwinds, so no newer operation can start that a late error or progress update could overwrite. perform then sets idle when the task was cancelled, or failed otherwise. With no task (the file chooser), cancel goes straight to idle.
  • importFile checks for cancellation after the detached install. It removes the placed file and throws CancellationError without saving an entry.
  • A repository listing that finishes after cancel is ignored.

I left restore-after-cancel as is: the file it replaces was already missing or damaged, so keeping the restored file is harmless. Tests: testCancelledImportSavesNothing and testCancelWhileChoosingReturnsToIdle.

- Block Use, Remove, Re-download and Restore while built-in engine
  actions are blocked (dictation, downloads, preparation), in the view
  and in the controller, so a recording never finishes on another engine
  and weights in use are never deleted.
- Record the effective built-in engine before selecting a custom model,
  so upgraded users without LastBuiltInSpeechModel fall back to their
  previous engine instead of the default.
- Cancel keeps task ownership until the work unwinds, so a late error or
  progress update cannot overwrite a newer operation; a cancelled import
  deletes its placed file and saves no entry; a late repository listing
  after cancel is ignored.
- Keep the revision of huggingface.co tree/<revision> links through
  parsing, listing (api/models/<repo>/revision/<rev>), file choice and
  download.
- Offer meeting and retranscription languages only from custom models
  whose file is present; saved meetings still validate independently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Custom GGUF speech models from Hugging Face for dictation and FluidMeet

1 participant