Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend apple_core_ml_library functionality #2506

Open
jiawen opened this issue Jul 28, 2024 · 2 comments
Open

Extend apple_core_ml_library functionality #2506

jiawen opened this issue Jul 28, 2024 · 2 comments

Comments

@jiawen
Copy link

jiawen commented Jul 28, 2024

apple_core_ml_library and its companion, swift_apple_core_ml_library are convenient wrappers for getting a model deployed. However, they are mostly a wrapper around coremlcompiler generate. There doesn't appear to be a wrapper around coremlcompiler compile that produces a .mlmodelc. compile_mlmodel is surfaced through resources_support but it doesn't seem to be used.

A Bazel-based wrapper around coremlcompiler compile that automatically passes arguments like --platform and --deployment-target xx.yy.zz would be extremely helpful.

@jiawen
Copy link
Author

jiawen commented Jul 28, 2024

For context, for my project, I just need the .mlmodelc, which I can then load via +MLModel loadContentsOfURL and friends. While the interface generated via coremlcompiler generate can be convenient, it has some annoying restrictions because the class name has to match that of the .mlpackage (so it can't start with a number, etc), and generates method names that match those of the input tensors (which now also places restrictions on them).

@jiawen
Copy link
Author

jiawen commented Oct 15, 2024

@yyuting discovered that if you put a .mlpackage into the data attribute of a suitable objc_library target, rules_apple's bundling automatically processes it into a .mlmodelc. This is nice and automatic but also surprising. Perhaps we should add a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant