Skip to content

Commit 504ac56

Browse files
authored
Add iOS bindings to ExecuTorch (#39)
## Description This PR provides a bridge between native ExecuTorch iOS API and TypeScript. It allows to perform basic ET operations such as running methods from arrays and loading them. ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [x] iOS - [ ] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent 6243ab3 commit 504ac56

File tree

25 files changed

+383
-338
lines changed

25 files changed

+383
-338
lines changed

ios/LLaMARunner.xcframework/Info.plist ios/ExecutorchLib.xcframework/Info.plist

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,33 @@
66
<array>
77
<dict>
88
<key>BinaryPath</key>
9-
<string>LLaMARunner.framework/LLaMARunner</string>
9+
<string>ExecutorchLib.framework/ExecutorchLib</string>
1010
<key>LibraryIdentifier</key>
11-
<string>ios-arm64-simulator</string>
11+
<string>ios-arm64</string>
1212
<key>LibraryPath</key>
13-
<string>LLaMARunner.framework</string>
13+
<string>ExecutorchLib.framework</string>
1414
<key>SupportedArchitectures</key>
1515
<array>
1616
<string>arm64</string>
1717
</array>
1818
<key>SupportedPlatform</key>
1919
<string>ios</string>
20-
<key>SupportedPlatformVariant</key>
21-
<string>simulator</string>
2220
</dict>
2321
<dict>
2422
<key>BinaryPath</key>
25-
<string>LLaMARunner.framework/LLaMARunner</string>
23+
<string>ExecutorchLib.framework/ExecutorchLib</string>
2624
<key>LibraryIdentifier</key>
27-
<string>ios-arm64</string>
25+
<string>ios-arm64-simulator</string>
2826
<key>LibraryPath</key>
29-
<string>LLaMARunner.framework</string>
27+
<string>ExecutorchLib.framework</string>
3028
<key>SupportedArchitectures</key>
3129
<array>
3230
<string>arm64</string>
3331
</array>
3432
<key>SupportedPlatform</key>
3533
<string>ios</string>
34+
<key>SupportedPlatformVariant</key>
35+
<string>simulator</string>
3636
</dict>
3737
</array>
3838
<key>CFBundlePackageType</key>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef ETModel_hpp
2+
#define ETModel_hpp
3+
4+
#import <UIKit/UIKit.h>
5+
6+
@interface ETModel : NSObject
7+
8+
- (NSNumber *)loadModel:(NSString *)filePath;
9+
- (NSNumber *)loadMethod:(NSString *)methodName;
10+
- (NSNumber *)loadForward;
11+
- (NSArray *)forward:(NSArray *)input
12+
shape:(NSArray *)shape
13+
inputType:(NSNumber *)inputType;
14+
15+
@end
16+
17+
#endif // ETModel_hpp

ios/LLaMARunner.xcframework/ios-arm64/LLaMARunner.framework/Headers/LLaMARunner.h ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/LLaMARunner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All rights reserved.
44
*
55
* This source code is licensed under the BSD-style license found in the
6-
* LICENSE file in the ExecuTorch repository - https://github.com/pytorch/executorch/blob/main/LICENSE.
6+
* LICENSE file in the root directory of this source tree.
77
*/
88

99
#import <UIKit/UIKit.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef ETModel_hpp
2+
#define ETModel_hpp
3+
4+
#import <UIKit/UIKit.h>
5+
6+
@interface ETModel : NSObject
7+
8+
- (NSNumber *)loadModel:(NSString *)filePath;
9+
- (NSNumber *)loadMethod:(NSString *)methodName;
10+
- (NSNumber *)loadForward;
11+
- (NSArray *)forward:(NSArray *)input
12+
shape:(NSArray *)shape
13+
inputType:(NSNumber *)inputType;
14+
15+
@end
16+
17+
#endif // ETModel_hpp

ios/LLaMARunner.xcframework/ios-arm64-simulator/LLaMARunner.framework/Headers/LLaMARunner.h ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/LLaMARunner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All rights reserved.
44
*
55
* This source code is licensed under the BSD-style license found in the
6-
* LICENSE file in the ExecuTorch repository - https://github.com/pytorch/executorch/blob/main/LICENSE.
6+
* LICENSE file in the root directory of this source tree.
77
*/
88

99
#import <UIKit/UIKit.h>

ios/LLaMARunner.xcframework/ios-arm64-simulator/LLaMARunner.framework/Modules/module.modulemap

-6
This file was deleted.

ios/LLaMARunner.xcframework/ios-arm64-simulator/LLaMARunner.framework/_CodeSignature/CodeResources

-124
This file was deleted.

ios/LLaMARunner.xcframework/ios-arm64/LLaMARunner.framework/Modules/module.modulemap

-6
This file was deleted.

ios/LLaMARunner.xcframework/ios-arm64/LLaMARunner.framework/_CodeSignature/CodeResources

-124
This file was deleted.

0 commit comments

Comments
 (0)