1 // 2 // model_package_info.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 #pragma once 9 10 #import <Foundation/Foundation.h> 11 12 #import "serde_json.h" 13 #import <string> 14 #import <unordered_map> 15 16 namespace executorchcoreml { 17 /// A struct containing the info of a `mlpackage`. 18 struct ModelPackageInfo { 19 struct Item { 20 /// The item author. 21 std::string author; 22 /// The item description. 23 std::string description; 24 /// The item name. 25 std::string name; 26 /// The item path. 27 std::string path; 28 }; 29 /// The identifier of the root model item. An entry for the name must exist in the `items`. 30 std::string root_model_identifier; 31 /// The items in the `mlpackage`. This is populated by parsing the `mlpackage`'s manifest file. 32 std::unordered_map<std::string, Item> items; 33 34 static std::optional<ModelPackageInfo> 35 make(NSURL* url, NSFileManager* fm, NSError* __autoreleasing* error) noexcept; 36 }; 37 } 38