Skip to content

Commit

Permalink
Add iOS bindings to ExecuTorch (#39)
Browse files Browse the repository at this point in the history
## 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. -->
  • Loading branch information
chmjkb authored Dec 2, 2024
1 parent 6243ab3 commit 504ac56
Show file tree
Hide file tree
Showing 25 changed files with 383 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
<array>
<dict>
<key>BinaryPath</key>
<string>LLaMARunner.framework/LLaMARunner</string>
<string>ExecutorchLib.framework/ExecutorchLib</string>
<key>LibraryIdentifier</key>
<string>ios-arm64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>LLaMARunner.framework</string>
<string>ExecutorchLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>LLaMARunner.framework/LLaMARunner</string>
<string>ExecutorchLib.framework/ExecutorchLib</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64-simulator</string>
<key>LibraryPath</key>
<string>LLaMARunner.framework</string>
<string>ExecutorchLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef ETModel_hpp
#define ETModel_hpp

#import <UIKit/UIKit.h>

@interface ETModel : NSObject

- (NSNumber *)loadModel:(NSString *)filePath;
- (NSNumber *)loadMethod:(NSString *)methodName;
- (NSNumber *)loadForward;
- (NSArray *)forward:(NSArray *)input
shape:(NSArray *)shape
inputType:(NSNumber *)inputType;

@end

#endif // ETModel_hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the ExecuTorch repository - https://github.com/pytorch/executorch/blob/main/LICENSE.
* LICENSE file in the root directory of this source tree.
*/

#import <UIKit/UIKit.h>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef ETModel_hpp
#define ETModel_hpp

#import <UIKit/UIKit.h>

@interface ETModel : NSObject

- (NSNumber *)loadModel:(NSString *)filePath;
- (NSNumber *)loadMethod:(NSString *)methodName;
- (NSNumber *)loadForward;
- (NSArray *)forward:(NSArray *)input
shape:(NSArray *)shape
inputType:(NSNumber *)inputType;

@end

#endif // ETModel_hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the ExecuTorch repository - https://github.com/pytorch/executorch/blob/main/LICENSE.
* LICENSE file in the root directory of this source tree.
*/

#import <UIKit/UIKit.h>
Expand Down
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 504ac56

Please sign in to comment.