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

Initialize Objective-C bindings #709

Open
wants to merge 56 commits into
base: main
Choose a base branch
from

Conversation

skyline75489
Copy link
Contributor

@skyline75489 skyline75489 commented Jul 18, 2024

This PR contains Objective-C wrapper code, podspec generation infras and the accompanying test code.

Internal workitem: https://task.ms/aii/35199

src/objectivec/error_utils.h Show resolved Hide resolved
src/objectivec/oga_internal.mm Show resolved Hide resolved
src/objectivec/oga_internal.h Show resolved Hide resolved
Copy link
Contributor

@edgchen1 edgchen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document public APIs and add unit tests

src/objectivec/oga_generator_params.mm Show resolved Hide resolved
src/objectivec/oga_internal.mm Outdated Show resolved Hide resolved
src/objectivec/oga_internal.h Show resolved Hide resolved
src/objectivec/oga_tokenizer.mm Outdated Show resolved Hide resolved
src/objectivec/oga_tokenizer.mm Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Show resolved Hide resolved
src/objectivec/oga_generator.mm Outdated Show resolved Hide resolved
src/objectivec/oga_images.mm Outdated Show resolved Hide resolved
src/objectivec/oga_internal.h Outdated Show resolved Hide resolved
src/objectivec/oga_internal.mm Outdated Show resolved Hide resolved
src/objectivec/oga_internal.mm Outdated Show resolved Hide resolved
src/objectivec/oga_sequences.mm Outdated Show resolved Hide resolved
src/objectivec/test/model_tests.mm Outdated Show resolved Hide resolved
tools/ci_build/github/apple/get_simulator_device_info.py Outdated Show resolved Hide resolved
src/objectivec/error_utils.mm Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/test/model_tests.mm Outdated Show resolved Hide resolved
src/objectivec/test/model_tests.mm Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/oga_internal.h Outdated Show resolved Hide resolved
src/objectivec/oga_sequences.mm Outdated Show resolved Hide resolved
src/objectivec/oga_sequences.mm Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/oga_tensor.mm Outdated Show resolved Hide resolved
src/objectivec/oga_tensor.mm Outdated Show resolved Hide resolved
src/objectivec/oga_tokenizer.mm Outdated Show resolved Hide resolved
src/objectivec/oga_internal.mm Outdated Show resolved Hide resolved

s.vendored_frameworks = "@ORTGENAI_C_FRAMEWORK@"
s.static_framework = true
s.framework = ['ImageIO', 'CoreGraphics']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why link to these frameworks? does anything in ort-genai depend on them? if not, should the decision to depend on them be left to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes ort-genai requires ImageIO and CoreGraphics for image decoding.

src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
src/objectivec/include/ort_genai_objc.h Outdated Show resolved Hide resolved
Comment on lines +128 to +132
snapshot_download(
repo_id="microsoft/Phi-3-mini-4k-instruct-onnx",
allow_patterns="cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/*",
local_dir=model_dir
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this model used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check in the actual testing code, because it's quite large. I copied the apple_pacakge_test in ORT and started from there. The actual testing code requires this model. I'll create another PR after this one.

tools/ci_build/github/apple/package_assembly_utils.py Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants