Skip to content

Commit 9d026b1

Browse files
Updated fallbackModelSupportConfig with extra device identifiers (#323)
* Updated `fallbackModelSupportConfig` with extra device identifiers * Tests compile * Fix tests, add repo checks * Fix incompatible comma for macos 13 --------- Co-authored-by: ZachNagengast <[email protected]>
1 parent d837ae3 commit 9d026b1

File tree

4 files changed

+320
-18
lines changed

4 files changed

+320
-18
lines changed

Sources/WhisperKit/Core/Models.swift

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,15 @@ public struct ModelSupport: Codable, Equatable {
189189
}
190190

191191
public struct DeviceSupport: Codable {
192+
/// Optional chip name string, intended for annotation only, e.g. "A16, A17"
193+
public let chips: String?
194+
/// Device identifiers, e.g. ["iPhone15,2", "iPhone15,3"]
192195
public let identifiers: [String]
196+
/// Model support for the device identifiers provided
193197
public var models: ModelSupport
194198

195-
public init(identifiers: [String], models: ModelSupport) {
199+
public init(chips: String? = nil, identifiers: [String], models: ModelSupport) {
200+
self.chips = chips
196201
self.identifiers = identifiers
197202
self.models = models
198203
}
@@ -225,7 +230,9 @@ public struct ModelSupportConfig: Codable {
225230
self.repoName = repoName
226231
self.repoVersion = repoVersion
227232

228-
if includeFallback {
233+
// Only use fallback for associated model repo
234+
if includeFallback,
235+
Constants.fallbackModelSupportConfig.repoName.contains(repoName) {
229236
self.deviceSupports = Self.mergeDeviceSupport(remote: deviceSupports, fallback: Constants.fallbackModelSupportConfig.deviceSupports)
230237
self.knownModels = self.deviceSupports.flatMap { $0.models.supported }.orderedSet
231238
} else {
@@ -275,7 +282,7 @@ public struct ModelSupportConfig: Codable {
275282
default: remoteSupport.models.default,
276283
supported: (remoteSupport.models.supported + fallbackSupport.models.supported).orderedSet
277284
)
278-
mergedSupports.append(DeviceSupport(identifiers: remoteSupport.identifiers, models: mergedModels))
285+
mergedSupports.append(DeviceSupport(chips: remoteSupport.chips, identifiers: remoteSupport.identifiers, models: mergedModels))
279286
} else {
280287
mergedSupports.append(remoteSupport)
281288
}
@@ -1593,10 +1600,16 @@ public enum Constants {
15931600
public static let fallbackModelSupportConfig: ModelSupportConfig = {
15941601
var config = ModelSupportConfig(
15951602
repoName: "whisperkit-coreml-fallback",
1596-
repoVersion: "0.2",
1603+
repoVersion: "0.3",
15971604
deviceSupports: [
15981605
DeviceSupport(
1599-
identifiers: ["iPhone11", "iPhone12", "Watch7", "Watch8"],
1606+
chips: "A12, A13, S9, S10",
1607+
identifiers: [
1608+
"iPhone11",
1609+
"iPhone12",
1610+
"Watch7",
1611+
"Watch8"
1612+
],
16001613
models: ModelSupport(
16011614
default: "openai_whisper-tiny",
16021615
supported: [
@@ -1608,7 +1621,14 @@ public enum Constants {
16081621
)
16091622
),
16101623
DeviceSupport(
1611-
identifiers: ["iPhone13", "iPad13,18", "iPad13,1"],
1624+
chips: "A14",
1625+
identifiers: [
1626+
"iPhone13",
1627+
"iPad13,1",
1628+
"iPad13,2",
1629+
"iPad13,18",
1630+
"iPad13,19"
1631+
],
16121632
models: ModelSupport(
16131633
default: "openai_whisper-base",
16141634
supported: [
@@ -1622,7 +1642,19 @@ public enum Constants {
16221642
)
16231643
),
16241644
DeviceSupport(
1625-
identifiers: ["iPhone14", "iPhone15", "iPhone16", "iPhone17", "iPad14,1", "iPad14,2"],
1645+
chips: "A15, A16, A17 Pro, A18",
1646+
identifiers: [
1647+
"iPhone14",
1648+
"iPhone15",
1649+
"iPhone16",
1650+
"iPhone17",
1651+
"iPad14,1",
1652+
"iPad14,2",
1653+
"iPad15,7",
1654+
"iPad15,8",
1655+
"iPad16,1",
1656+
"iPad16,2"
1657+
],
16261658
models: ModelSupport(
16271659
default: "openai_whisper-base",
16281660
supported: [
@@ -1644,19 +1676,31 @@ public enum Constants {
16441676
)
16451677
),
16461678
DeviceSupport(
1679+
chips: "M1",
16471680
identifiers: [
1648-
"Mac13",
1649-
"iMac21",
1681+
"MacBookPro17,1",
1682+
"MacBookPro18,1",
1683+
"MacBookPro18,2",
1684+
"MacBookPro18,3",
1685+
"MacBookPro18,4",
16501686
"MacBookAir10,1",
1651-
"MacBookPro17",
1652-
"MacBookPro18",
1653-
"Macmini9",
1654-
"iPad13,16",
1687+
"Macmini9,1",
1688+
"iMac21,1",
1689+
"iMac21,2",
1690+
"Mac13",
16551691
"iPad13,4",
1692+
"iPad13,5",
1693+
"iPad13,6",
1694+
"iPad13,7",
16561695
"iPad13,8",
1696+
"iPad13,9",
1697+
"iPad13,10",
1698+
"iPad13,11",
1699+
"iPad13,16",
1700+
"iPad13,17"
16571701
],
16581702
models: ModelSupport(
1659-
default: "openai_whisper-large-v3-v20240930",
1703+
default: "openai_whisper-large-v3-v20240930_626MB",
16601704
supported: [
16611705
"openai_whisper-tiny",
16621706
"openai_whisper-tiny.en",
@@ -1676,6 +1720,7 @@ public enum Constants {
16761720
)
16771721
),
16781722
DeviceSupport(
1723+
chips: "M2, M3, M4",
16791724
identifiers: [
16801725
"Mac14",
16811726
"Mac15",
@@ -1688,6 +1733,7 @@ public enum Constants {
16881733
"iPad14,9",
16891734
"iPad14,10",
16901735
"iPad14,11",
1736+
"iPad15",
16911737
"iPad16",
16921738
],
16931739
models: ModelSupport(
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"name": "whisperkit-coreml",
3+
"version": "0.3",
4+
"device_support": [
5+
{
6+
"chips": "A12, A13, S9, S10",
7+
"identifiers": [
8+
"iPhone11",
9+
"iPhone12",
10+
"Watch7",
11+
"Watch8"
12+
],
13+
"models": {
14+
"default": "openai_whisper-tiny",
15+
"supported": [
16+
"openai_whisper-tiny",
17+
"openai_whisper-tiny.en",
18+
"openai_whisper-base",
19+
"openai_whisper-base.en"
20+
]
21+
}
22+
},
23+
{
24+
"chips": "A14",
25+
"identifiers": [
26+
"iPhone13",
27+
"iPad13,1",
28+
"iPad13,2",
29+
"iPad13,18",
30+
"iPad13,19"
31+
],
32+
"models": {
33+
"default": "openai_whisper-base",
34+
"supported": [
35+
"openai_whisper-tiny",
36+
"openai_whisper-tiny.en",
37+
"openai_whisper-base",
38+
"openai_whisper-base.en",
39+
"openai_whisper-small",
40+
"openai_whisper-small.en"
41+
]
42+
}
43+
},
44+
{
45+
"chips": "A15, A16, A17 Pro, A18",
46+
"identifiers": [
47+
"iPhone14",
48+
"iPhone15",
49+
"iPhone16",
50+
"iPhone17",
51+
"iPad14,1",
52+
"iPad14,2",
53+
"iPad15,7",
54+
"iPad15,8",
55+
"iPad16,1",
56+
"iPad16,2"
57+
],
58+
"models": {
59+
"default": "openai_whisper-base",
60+
"supported": [
61+
"openai_whisper-tiny",
62+
"openai_whisper-tiny.en",
63+
"openai_whisper-base",
64+
"openai_whisper-base.en",
65+
"openai_whisper-small",
66+
"openai_whisper-small.en",
67+
"openai_whisper-large-v2_949MB",
68+
"openai_whisper-large-v2_turbo_955MB",
69+
"openai_whisper-large-v3_947MB",
70+
"openai_whisper-large-v3_turbo_954MB",
71+
"distil-whisper_distil-large-v3_594MB",
72+
"distil-whisper_distil-large-v3_turbo_600MB",
73+
"openai_whisper-large-v3-v20240930_626MB",
74+
"openai_whisper-large-v3-v20240930_turbo_632MB"
75+
]
76+
}
77+
},
78+
{
79+
"chips": "M1",
80+
"identifiers": [
81+
"MacBookPro17,1",
82+
"MacBookPro18,1",
83+
"MacBookPro18,2",
84+
"MacBookPro18,3",
85+
"MacBookPro18,4",
86+
"MacBookAir10,1",
87+
"Macmini9,1",
88+
"iMac21,1",
89+
"iMac21,2",
90+
"Mac13",
91+
"iPad13,4",
92+
"iPad13,5",
93+
"iPad13,6",
94+
"iPad13,7",
95+
"iPad13,8",
96+
"iPad13,9",
97+
"iPad13,10",
98+
"iPad13,11",
99+
"iPad13,16",
100+
"iPad13,17"
101+
],
102+
"models": {
103+
"default": "openai_whisper-large-v3-v20240930_626MB",
104+
"supported": [
105+
"openai_whisper-tiny",
106+
"openai_whisper-tiny.en",
107+
"openai_whisper-base",
108+
"openai_whisper-base.en",
109+
"openai_whisper-small",
110+
"openai_whisper-small.en",
111+
"openai_whisper-large-v2",
112+
"openai_whisper-large-v2_949MB",
113+
"openai_whisper-large-v3",
114+
"openai_whisper-large-v3_947MB",
115+
"distil-whisper_distil-large-v3",
116+
"distil-whisper_distil-large-v3_594MB",
117+
"openai_whisper-large-v3-v20240930_626MB"
118+
]
119+
}
120+
},
121+
{
122+
"chips": "M2, M3, M4",
123+
"identifiers": [
124+
"Mac14",
125+
"Mac15",
126+
"Mac16",
127+
"iPad14,3",
128+
"iPad14,4",
129+
"iPad14,5",
130+
"iPad14,6",
131+
"iPad14,8",
132+
"iPad14,9",
133+
"iPad14,10",
134+
"iPad14,11",
135+
"iPad15",
136+
"iPad16"
137+
],
138+
"models": {
139+
"default": "openai_whisper-large-v3-v20240930",
140+
"supported": [
141+
"openai_whisper-tiny",
142+
"openai_whisper-tiny.en",
143+
"openai_whisper-base",
144+
"openai_whisper-base.en",
145+
"openai_whisper-small",
146+
"openai_whisper-small.en",
147+
"openai_whisper-large-v2",
148+
"openai_whisper-large-v2_949MB",
149+
"openai_whisper-large-v2_turbo",
150+
"openai_whisper-large-v2_turbo_955MB",
151+
"openai_whisper-large-v3",
152+
"openai_whisper-large-v3_947MB",
153+
"openai_whisper-large-v3_turbo",
154+
"openai_whisper-large-v3_turbo_954MB",
155+
"distil-whisper_distil-large-v3",
156+
"distil-whisper_distil-large-v3_594MB",
157+
"distil-whisper_distil-large-v3_turbo",
158+
"distil-whisper_distil-large-v3_turbo_600MB",
159+
"openai_whisper-large-v3-v20240930",
160+
"openai_whisper-large-v3-v20240930_turbo",
161+
"openai_whisper-large-v3-v20240930_626MB",
162+
"openai_whisper-large-v3-v20240930_turbo_632MB"
163+
]
164+
}
165+
}
166+
],
167+
"model_checksums": {
168+
"distil-whisper_distil-large-v3": "9cd8271143b919402ae776c30b479565",
169+
"distil-whisper_distil-large-v3_594MB": "ca532f45ddbf8a3d241132cc5cf41639",
170+
"distil-whisper_distil-large-v3_turbo": "b8638452c6568dfe33a33bfcc2bc6aca",
171+
"distil-whisper_distil-large-v3_turbo_600MB": "81746b4b1afbbb01a8ae9ea452460d88",
172+
"openai_whisper-base.en": "fbcfd586f15e2952251b1d3257f18471",
173+
"openai_whisper-base": "36e60501ad0f01c1a5719e83a1f63f20",
174+
"openai_whisper-large-v2": "21b86c07318aeeef54598f15b7903979",
175+
"openai_whisper-large-v2_949MB": "71bad4e1566749d1060eda42308d9fb4",
176+
"openai_whisper-large-v2_turbo": "7734959b6550e7b5c2d732bf2b7acd23",
177+
"openai_whisper-large-v2_turbo_955MB": "cb6411862a48ec75325572081f01e5b5",
178+
"openai_whisper-large-v3-v20240930": "17ebd78ff7edfa59001b554e9cc4c021",
179+
"openai_whisper-large-v3-v20240930_547MB": "c945dad68449ac3c78ecb2d561ac189d",
180+
"openai_whisper-large-v3-v20240930_626MB": "578fe5a07f4eb7e4187c920bca571aa5",
181+
"openai_whisper-large-v3-v20240930_turbo": "dfbf09ab741af1d5400ddbd07bb37dad",
182+
"openai_whisper-large-v3-v20240930_turbo_632MB": "33954440dbd785ca1828afe25514f5a5",
183+
"openai_whisper-large-v3": "a6f24dc72785722e9cea89e227856dfe",
184+
"openai_whisper-large-v3_947MB": "ef6b0e9622a046ce2361b4c72307877f",
185+
"openai_whisper-large-v3_turbo": "c550fbdea70c5784d322c0a427f8b5cd",
186+
"openai_whisper-large-v3_turbo_954MB": "e639c4bb98d905064ef5dd38757dd9d1",
187+
"openai_whisper-small.en": "38efe6a00706bbdb995795c67a836e5e",
188+
"openai_whisper-small": "f1d21adb950bc9be5d5343bcdeccd23b",
189+
"openai_whisper-tiny.en": "e1183fd55448923b1ce43a2da67aa21f",
190+
"openai_whisper-tiny": "7147518a3d68ddbea0691e04cfffa4ff"
191+
}
192+
}

0 commit comments

Comments
 (0)