|
| 1 | +// |
| 2 | +// whisper-decoder-impl.h |
| 3 | +// |
| 4 | +// This file was automatically generated and should not be edited. |
| 5 | +// |
| 6 | + |
| 7 | +#import <Foundation/Foundation.h> |
| 8 | +#import <CoreML/CoreML.h> |
| 9 | +#include <stdint.h> |
| 10 | +#include <os/log.h> |
| 11 | + |
| 12 | +NS_ASSUME_NONNULL_BEGIN |
| 13 | + |
| 14 | + |
| 15 | +/// Model Prediction Input Type |
| 16 | +API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) __attribute__((visibility("hidden"))) |
| 17 | +@interface whisper_decoder_implInput : NSObject<MLFeatureProvider> |
| 18 | + |
| 19 | +/// token_data as 1 by 1 matrix of 32-bit integers |
| 20 | +@property (readwrite, nonatomic, strong) MLMultiArray * token_data; |
| 21 | + |
| 22 | +/// audio_data as 1 × 384 × 1 × 1500 4-dimensional array of floats |
| 23 | +@property (readwrite, nonatomic, strong) MLMultiArray * audio_data; |
| 24 | +- (instancetype)init NS_UNAVAILABLE; |
| 25 | +- (instancetype)initWithToken_data:(MLMultiArray *)token_data audio_data:(MLMultiArray *)audio_data NS_DESIGNATED_INITIALIZER; |
| 26 | + |
| 27 | +@end |
| 28 | + |
| 29 | + |
| 30 | +/// Model Prediction Output Type |
| 31 | +API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) __attribute__((visibility("hidden"))) |
| 32 | +@interface whisper_decoder_implOutput : NSObject<MLFeatureProvider> |
| 33 | + |
| 34 | +/// var_1346 as multidimensional array of floats |
| 35 | +@property (readwrite, nonatomic, strong) MLMultiArray * var_1346; |
| 36 | +- (instancetype)init NS_UNAVAILABLE; |
| 37 | +- (instancetype)initWithVar_1346:(MLMultiArray *)var_1346 NS_DESIGNATED_INITIALIZER; |
| 38 | + |
| 39 | +@end |
| 40 | + |
| 41 | + |
| 42 | +/// Class for model loading and prediction |
| 43 | +API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) __attribute__((visibility("hidden"))) |
| 44 | +@interface whisper_decoder_impl : NSObject |
| 45 | +@property (readonly, nonatomic, nullable) MLModel * model; |
| 46 | + |
| 47 | +/** |
| 48 | + URL of the underlying .mlmodelc directory. |
| 49 | +*/ |
| 50 | ++ (nullable NSURL *)URLOfModelInThisBundle; |
| 51 | + |
| 52 | +/** |
| 53 | + Initialize whisper_decoder_impl instance from an existing MLModel object. |
| 54 | +
|
| 55 | + Usually the application does not use this initializer unless it makes a subclass of whisper_decoder_impl. |
| 56 | + Such application may want to use `-[MLModel initWithContentsOfURL:configuration:error:]` and `+URLOfModelInThisBundle` to create a MLModel object to pass-in. |
| 57 | +*/ |
| 58 | +- (instancetype)initWithMLModel:(MLModel *)model NS_DESIGNATED_INITIALIZER; |
| 59 | + |
| 60 | +/** |
| 61 | + Initialize whisper_decoder_impl instance with the model in this bundle. |
| 62 | +*/ |
| 63 | +- (nullable instancetype)init; |
| 64 | + |
| 65 | +/** |
| 66 | + Initialize whisper_decoder_impl instance with the model in this bundle. |
| 67 | +
|
| 68 | + @param configuration The model configuration object |
| 69 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 70 | +*/ |
| 71 | +- (nullable instancetype)initWithConfiguration:(MLModelConfiguration *)configuration error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 72 | + |
| 73 | +/** |
| 74 | + Initialize whisper_decoder_impl instance from the model URL. |
| 75 | +
|
| 76 | + @param modelURL URL to the .mlmodelc directory for whisper_decoder_impl. |
| 77 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 78 | +*/ |
| 79 | +- (nullable instancetype)initWithContentsOfURL:(NSURL *)modelURL error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 80 | + |
| 81 | +/** |
| 82 | + Initialize whisper_decoder_impl instance from the model URL. |
| 83 | +
|
| 84 | + @param modelURL URL to the .mlmodelc directory for whisper_decoder_impl. |
| 85 | + @param configuration The model configuration object |
| 86 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 87 | +*/ |
| 88 | +- (nullable instancetype)initWithContentsOfURL:(NSURL *)modelURL configuration:(MLModelConfiguration *)configuration error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 89 | + |
| 90 | +/** |
| 91 | + Construct whisper_decoder_impl instance asynchronously with configuration. |
| 92 | + Model loading may take time when the model content is not immediately available (e.g. encrypted model). Use this factory method especially when the caller is on the main thread. |
| 93 | +
|
| 94 | + @param configuration The model configuration |
| 95 | + @param handler When the model load completes successfully or unsuccessfully, the completion handler is invoked with a valid whisper_decoder_impl instance or NSError object. |
| 96 | +*/ |
| 97 | ++ (void)loadWithConfiguration:(MLModelConfiguration *)configuration completionHandler:(void (^)(whisper_decoder_impl * _Nullable model, NSError * _Nullable error))handler; |
| 98 | + |
| 99 | +/** |
| 100 | + Construct whisper_decoder_impl instance asynchronously with URL of .mlmodelc directory and optional configuration. |
| 101 | +
|
| 102 | + Model loading may take time when the model content is not immediately available (e.g. encrypted model). Use this factory method especially when the caller is on the main thread. |
| 103 | +
|
| 104 | + @param modelURL The model URL. |
| 105 | + @param configuration The model configuration |
| 106 | + @param handler When the model load completes successfully or unsuccessfully, the completion handler is invoked with a valid whisper_decoder_impl instance or NSError object. |
| 107 | +*/ |
| 108 | ++ (void)loadContentsOfURL:(NSURL *)modelURL configuration:(MLModelConfiguration *)configuration completionHandler:(void (^)(whisper_decoder_impl * _Nullable model, NSError * _Nullable error))handler; |
| 109 | + |
| 110 | +/** |
| 111 | + Make a prediction using the standard interface |
| 112 | + @param input an instance of whisper_decoder_implInput to predict from |
| 113 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 114 | + @return the prediction as whisper_decoder_implOutput |
| 115 | +*/ |
| 116 | +- (nullable whisper_decoder_implOutput *)predictionFromFeatures:(whisper_decoder_implInput *)input error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 117 | + |
| 118 | +/** |
| 119 | + Make a prediction using the standard interface |
| 120 | + @param input an instance of whisper_decoder_implInput to predict from |
| 121 | + @param options prediction options |
| 122 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 123 | + @return the prediction as whisper_decoder_implOutput |
| 124 | +*/ |
| 125 | +- (nullable whisper_decoder_implOutput *)predictionFromFeatures:(whisper_decoder_implInput *)input options:(MLPredictionOptions *)options error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 126 | + |
| 127 | +/** |
| 128 | + Make a prediction using the convenience interface |
| 129 | + @param token_data as 1 by 1 matrix of 32-bit integers: |
| 130 | + @param audio_data as 1 × 384 × 1 × 1500 4-dimensional array of floats: |
| 131 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 132 | + @return the prediction as whisper_decoder_implOutput |
| 133 | +*/ |
| 134 | +- (nullable whisper_decoder_implOutput *)predictionFromToken_data:(MLMultiArray *)token_data audio_data:(MLMultiArray *)audio_data error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 135 | + |
| 136 | +/** |
| 137 | + Batch prediction |
| 138 | + @param inputArray array of whisper_decoder_implInput instances to obtain predictions from |
| 139 | + @param options prediction options |
| 140 | + @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in possible errors, pass in NULL. |
| 141 | + @return the predictions as NSArray<whisper_decoder_implOutput *> |
| 142 | +*/ |
| 143 | +- (nullable NSArray<whisper_decoder_implOutput *> *)predictionsFromInputs:(NSArray<whisper_decoder_implInput*> *)inputArray options:(MLPredictionOptions *)options error:(NSError * _Nullable __autoreleasing * _Nullable)error; |
| 144 | +@end |
| 145 | + |
| 146 | +NS_ASSUME_NONNULL_END |
0 commit comments