@@ -12,7 +12,7 @@ import Generation
12
12
import Hub
13
13
import Tokenizers
14
14
15
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
15
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
16
16
/// A high-level interface for language model inference using CoreML.
17
17
///
18
18
/// `LanguageModel` provides a convenient way to load and interact with pre-trained
@@ -72,7 +72,7 @@ public class LanguageModel {
72
72
}
73
73
}
74
74
75
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
75
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
76
76
private extension LanguageModel {
77
77
static func contextRange( from model: MLModel ) -> ( min: Int , max: Int ) {
78
78
contextRange ( from: model, inputKey: Keys . inputIds)
@@ -109,7 +109,7 @@ private extension LanguageModel {
109
109
}
110
110
}
111
111
112
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
112
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
113
113
extension LanguageModel {
114
114
struct Configurations {
115
115
var modelConfig : Config
@@ -118,7 +118,7 @@ extension LanguageModel {
118
118
}
119
119
}
120
120
121
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
121
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
122
122
extension LanguageModel {
123
123
enum Keys {
124
124
// Input keys
@@ -135,7 +135,7 @@ extension LanguageModel {
135
135
}
136
136
}
137
137
138
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
138
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
139
139
public extension LanguageModel {
140
140
/// Loads a compiled CoreML model from disk.
141
141
///
@@ -155,7 +155,7 @@ public extension LanguageModel {
155
155
}
156
156
}
157
157
158
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
158
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
159
159
extension LanguageModel {
160
160
enum KVCacheAvailability {
161
161
/// Language models that support KV cache via state. Implementation details for handling state
@@ -167,7 +167,7 @@ extension LanguageModel {
167
167
}
168
168
}
169
169
170
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
170
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
171
171
public extension LanguageModel {
172
172
/// Metadata fields associated to the Core ML model.
173
173
var metadata : [ MLModelMetadataKey : Any ] {
@@ -296,7 +296,7 @@ public extension LanguageModel {
296
296
// MARK: - Configuration Properties
297
297
298
298
/// Asynchronous properties that are downloaded from the Hugging Face Hub configuration.
299
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
299
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
300
300
public extension LanguageModel {
301
301
/// The model configuration dictionary.
302
302
///
@@ -402,7 +402,7 @@ public extension LanguageModel {
402
402
403
403
// MARK: - TextGenerationModel Conformance
404
404
405
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
405
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
406
406
extension LanguageModel : TextGenerationModel {
407
407
/// The default generation configuration for this model.
408
408
///
@@ -424,7 +424,7 @@ extension LanguageModel: TextGenerationModel {
424
424
///
425
425
/// Maintains a KV Cache as sequence generation progresses,
426
426
/// using stateful Core ML buffers to minimize latency.
427
- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
427
+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
428
428
public class LanguageModelWithStatefulKVCache : LanguageModel {
429
429
private enum Mode {
430
430
case prefilling
0 commit comments