df1c5ff32c
Replace MLX GPU inference with CoreML bundles so transcription continues while the host app is backgrounded. Adds model download and warm-up, vendored Qwen3Speech, and updates onboarding, settings, and copy for the ~1.6 GB CoreML package (iOS 18+).
55 lines
1.4 KiB
Swift
55 lines
1.4 KiB
Swift
// OnDeviceModel.swift
|
|
// OSGKeyboard · Shared
|
|
//
|
|
// Identity of an on-device model the host app downloads and the
|
|
// keyboard extension observes via App Group flags (the extension
|
|
// cannot read the main app's Caches directory).
|
|
|
|
import Foundation
|
|
|
|
public enum OnDeviceModel: String, CaseIterable, Identifiable, Sendable {
|
|
case qwen3ASR
|
|
|
|
public var id: String { rawValue }
|
|
|
|
/// CoreML inference bundle (`aufklarer/Qwen3-ASR-CoreML`), derived from
|
|
/// official `Qwen/Qwen3-ASR-0.6B`.
|
|
public var repoId: String {
|
|
switch self {
|
|
case .qwen3ASR: return "aufklarer/Qwen3-ASR-CoreML"
|
|
}
|
|
}
|
|
|
|
/// Tokenizer files (vocab / merges) pulled from the upstream Qwen repo.
|
|
public var tokenizerRepoId: String {
|
|
switch self {
|
|
case .qwen3ASR: return "Qwen/Qwen3-ASR-0.6B"
|
|
}
|
|
}
|
|
|
|
public var displayName: String {
|
|
switch self {
|
|
case .qwen3ASR: return "Qwen3-ASR 0.6B (CoreML)"
|
|
}
|
|
}
|
|
|
|
public var approximateSizeMB: Int {
|
|
switch self {
|
|
case .qwen3ASR: return 1_600
|
|
}
|
|
}
|
|
|
|
public var compactSizeLabel: String {
|
|
"\(approximateSizeMB)M"
|
|
}
|
|
|
|
/// Settings list title: model name plus compact size.
|
|
public var listTitle: String {
|
|
"\(displayName) · \(compactSizeLabel)"
|
|
}
|
|
|
|
public var repoAndSizeLabel: String {
|
|
"\(repoId) · \(approximateSizeMB) MB"
|
|
}
|
|
}
|