1 // 2 // ETCoreMLModelLoader.h 3 // 4 // Copyright © 2024 Apple Inc. All rights reserved. 5 // 6 // Please refer to the license found in the LICENSE file in the root directory of the source tree. 7 8 #import <CoreML/CoreML.h> 9 10 @class ETCoreMLModel; 11 @class ETCoreMLAssetManager; 12 13 namespace executorchcoreml { 14 struct ModelMetadata; 15 } 16 17 NS_ASSUME_NONNULL_BEGIN 18 /// A class responsible for loading a CoreML model. 19 __attribute__((objc_subclassing_restricted)) 20 @interface ETCoreMLModelLoader : NSObject 21 22 + (instancetype)new NS_UNAVAILABLE; 23 24 - (instancetype)init NS_UNAVAILABLE; 25 26 /// Synchronously loads a model given the location of its on-disk representation and configuration. 27 /// 28 /// @param compiledModelURL The location of the model's on-disk representation (.mlmodelc directory). 29 /// @param configuration The model configuration. 30 /// @param metadata The model metadata. 31 /// @param assetManager The asset manager used to manage storage of compiled models. 32 /// @param error On failure, error is filled with the failure information. 33 + (nullable ETCoreMLModel*)loadModelWithContentsOfURL:(NSURL*)compiledModelURL 34 configuration:(MLModelConfiguration*)configuration 35 metadata:(const executorchcoreml::ModelMetadata&)metadata 36 assetManager:(ETCoreMLAssetManager*)assetManager 37 error:(NSError* __autoreleasing*)error; 38 39 @end 40 41 NS_ASSUME_NONNULL_END 42