{"id":25436667,"url":"https://github.com/h3x4g0ns/model2c","last_synced_at":"2026-04-11T03:34:05.247Z","repository":{"id":44305839,"uuid":"511767779","full_name":"h3x4g0ns/model2c","owner":"h3x4g0ns","description":"tool to convert ML models into low-level inference for embedded platforms","archived":false,"fork":false,"pushed_at":"2022-07-29T04:55:46.000Z","size":5393,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-28T20:03:01.145Z","etag":null,"topics":["arduino","embedded-systems","machine-learning","onnx","tensorflow","tinyml","torch"],"latest_commit_sha":null,"homepage":"","language":"Python","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/h3x4g0ns.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}},"created_at":"2022-07-08T05:00:27.000Z","updated_at":"2023-09-24T18:25:48.000Z","dependencies_parsed_at":"2022-09-12T08:40:08.024Z","dependency_job_id":null,"html_url":"https://github.com/h3x4g0ns/model2c","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/h3x4g0ns/model2c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3x4g0ns%2Fmodel2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3x4g0ns%2Fmodel2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3x4g0ns%2Fmodel2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3x4g0ns%2Fmodel2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h3x4g0ns","download_url":"https://codeload.github.com/h3x4g0ns/model2c/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h3x4g0ns%2Fmodel2c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31668049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arduino","embedded-systems","machine-learning","onnx","tensorflow","tinyml","torch"],"created_at":"2025-02-17T08:21:33.416Z","updated_at":"2026-04-11T03:34:05.217Z","avatar_url":"https://github.com/h3x4g0ns.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# model2c\n\n![pypi build](https://img.shields.io/github/workflow/status/h3x4g0ns/model2c/pypi-build)\n[![PyPI version](https://badge.fury.io/py/model2c.svg)](https://badge.fury.io/py/model2c)\n\n\n## About the Project\n\nPython API and Command Line tool to convert ML models into low-level inference for embedded platforms\n\n## Getting Started\n\n### Prerequisites\n\nMake sure you have `tensorflow tf2onnx` or `torch` installed.\n\nFurthermore, make sure you have `onnx2c` installed and added to `PATH`.\n\nLastly you need ProtocolBuffers libraries installed, e.g.:\n\n- Ubuntu: `apt install libprotobuf-dev protobuf-compiler`\n- MacOS: `brew install protobuf`\n\nGet the sources:\n\n```sh\ngit clone https://github.com/kraiskil/onnx2c.git\ncd onnx2c\ngit submodule update --init\n```\n\nThen run a standard CMake build\n\n```sh\nmkdir build\ncd build\ncmake ..\nmake onnx2c\n```\n\nAnd finally add to path\n\n```sh\nexport PATH=$PATH:/path/to/onnx2c/folder\n```\n\n## Installation \n\nYou can can install the package through `pypi`:\n\n```sh\npip install model2c\n```\n\nOr you can clone the repo and build directly from source:\n\n```sh\ngit clone git@github.com:h3x4g0ns/model2c.git\ncd model2c\nmake install\n```\n\n### Usage\n\nTrain a model with correponding data until sufficient metrics are obtained.\n\n```py\nimport torch\nimport model2c.pytorch import convert\n\n# run convertor\nconvert(model=torch_model, \n        input_shape=(batch_size, 1, 224, 224),\n        quantization=\"fp32\",\n        output_file=\"model.c\")\nprint(f\"size of output model: {os.path.getsize('model.c')/1024} kilobytes\")\n```\n\n## Support\n\n`model2c` currently supports the following ML frameworks\n- `torch`\n- `tf/keras`\n\n## To Do\n\n- [x] `torch` convert\n- [x] `tf` convert\n- [ ] make command line utility\n- [ ] include dynamic axis for batch size\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3x4g0ns%2Fmodel2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh3x4g0ns%2Fmodel2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh3x4g0ns%2Fmodel2c/lists"}