{"id":19690501,"url":"https://github.com/olilarkin/ort-builder","last_synced_at":"2025-04-29T08:35:47.958Z","repository":{"id":142341054,"uuid":"599676261","full_name":"olilarkin/ort-builder","owner":"olilarkin","description":"ONNX Runtime static library builder","archived":false,"fork":false,"pushed_at":"2025-04-22T21:44:53.000Z","size":50519,"stargazers_count":54,"open_issues_count":5,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-22T22:24:42.909Z","etag":null,"topics":["machine-learning","onnx","onnxruntime"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olilarkin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-09T16:41:00.000Z","updated_at":"2025-04-22T21:44:57.000Z","dependencies_parsed_at":"2024-05-22T23:42:32.252Z","dependency_job_id":"e680e7f7-c9f7-4666-9e81-6a08be86ed28","html_url":"https://github.com/olilarkin/ort-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olilarkin%2Fort-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olilarkin%2Fort-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olilarkin%2Fort-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olilarkin%2Fort-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olilarkin","download_url":"https://codeload.github.com/olilarkin/ort-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251465371,"owners_count":21593871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","onnx","onnxruntime"],"created_at":"2024-11-11T19:05:42.478Z","updated_at":"2025-04-29T08:35:47.946Z","avatar_url":"https://github.com/olilarkin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ONNX Runtime static library builder\n\nConverts an [ONNX](https://onnx.ai) model to ORT format and serializes it to C++ source code, generate custom slimmed ONNX Runtime static libs \u0026 xcframework for apple platforms.\n\nThe goal here is to create a flexible but tiny inference engine for a specific model e.g. [iPlug2 example](https://github.com/olilarkin/iPlug2OnnxRuntime).\n\n*NOTE: due to risk of ODR violations, global/static variable conflicts, and dependency symbol clashes with DAW Hosts that use ORT themselves - think hard before you use this in an audio plugin!*\n\nThe scripts here are configured to create a minimal ORT binary using only the CPU provider. If you want to experiment with GPU inference, Core ML etc, you will have to modify.\n\n## Requirements:\n\nCMake v2.6+\n\n## Instructions:\n\n1. Checkout ONNX Runtime submodule `$ git submodule update --init`\n\n2. Create a [virtual environment](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) and activate it\n\nwindows\n```bash\n$ py -3 -m venv venv\n$ source ./venv/Scripts/activate`\n```\n\nmac/linux\n```bash\n$ python3 -m venv venv\n$ source ./venv/bin/activate`\n```\n\n3. Install dependencies `$ pip install -r requirements.txt`\n\n4. Run `$ ./convert-model-to-ort.sh model.onnx`\nThis converts the .onnx file to .ort and produces a .config file which slims the onnxruntime library build in the next step.\nIt also serializes the .ort format model to C++ source code, which can be used to bake the model into your app binary. If the model\nis large this might not be a great solution, and it might be better to locate the .ort file at runtime.\n\n6. Build customized onnx runtime static libraries\n\n```mac\n$ ./build-mac.sh\n```\n\n```ios\n$ ./build-ios.sh\n$ ./build-ios-simulator.sh\n```\n\n```xcframework build\n$ ./build-xcframework.sh\n```\n\n**Note:** windows static lib builds can get very large due to the LTO/LTCG settings in onnxruntime. \nYou can turn that off by applying the change in ltcg_patch_for_windows.patch to the onnxruntime repo.\nDue to different MSVC runtimes for Debug and Release builds, we need to build two binaries for windows.\n\n```windows\n$ ./build-win.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folilarkin%2Fort-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folilarkin%2Fort-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folilarkin%2Fort-builder/lists"}