{"id":28126133,"url":"https://github.com/willayy/modularml-lib","last_synced_at":"2026-07-17T12:11:12.116Z","repository":{"id":290784616,"uuid":"975549500","full_name":"willayy/modularml-lib","owner":"willayy","description":"Library version of modularml thats easily installed and used.","archived":false,"fork":false,"pushed_at":"2025-05-18T15:47:15.000Z","size":10754,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T15:04:30.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/willayy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2025-04-30T13:52:17.000Z","updated_at":"2025-05-18T14:57:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"796cd7e4-2a5b-4675-9a04-bde2e0f0f2bc","html_url":"https://github.com/willayy/modularml-lib","commit_stats":null,"previous_names":["willayy/modularml-lib"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/willayy/modularml-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willayy%2Fmodularml-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willayy%2Fmodularml-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willayy%2Fmodularml-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willayy%2Fmodularml-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willayy","download_url":"https://codeload.github.com/willayy/modularml-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willayy%2Fmodularml-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35581059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-17T02:00:06.162Z","response_time":116,"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":[],"created_at":"2025-05-14T10:23:19.124Z","updated_at":"2026-07-17T12:11:12.060Z","avatar_url":"https://github.com/willayy.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModularML\nLightweight and modular library for building cpp integrated machine learning models from onnx models.\n\n### Installation\n\nInstall the library and link it to your project using CMake. This is done by pasting the following code into your CMakeLists.txt file.\n\n```cmake\n# ----------------------- MODULARML -------------------------- #\ninclude(FetchContent)\nFetchContent_Declare(\n    modularml\n    GIT_REPOSITORY https://github.com/willayy/modularml-lib\n    GIT_TAG        \u003cuse latest release tag\u003e\n)\nFetchContent_MakeAvailable(modularml)\ntarget_link_libraries(MyProject PRIVATE modularml)\n# ------------------------------------------------------------ #\n```\n\n### Usage\n```cpp\n#include \u003cmodularml\u003e\n#include \u003cmemory\u003e\n#include \u003ciostream\u003e\n\n// Define the blocked gemm flag to enable the compilation of the blocked gemm function\n#define USE_BLOCKED_GEMM\n\nint main() {\n\n  // Dynamically change the gemm function pointer to point to the blocked version, this works for any function \n  // with a matching signature.\n  TensorOperations::set_gemm_ptr\u003cint, float, double\u003e(\n    mml_gemm_blocked\u003cint\u003e, \n    mml_gemm_blocked\u003cfloat\u003e, \n    mml_gemm_blocked\u003cdouble\u003e\n  );\n\n  // Use the TensorFactory to create tensors\n  auto a = TensorFactory::create_tensor\u003cint\u003e({2, 3}, {1, 2, 3, 4, 5, 6});\n  auto b = TensorFactory::create_tensor\u003cint\u003e({3, 2}, {7, 8, 9, 10, 11, 12});\n  auto c = TensorFactory::create_tensor\u003cint\u003e({2, 3});\n\n  // Perform the gemm operation using the blocked version.\n  TensorOperations::gemm\u003cint\u003e(0, 0, 2, 2, 3, 1, a, 3, b, 2, 1, c, 2);\n\n  // Print the result, ensuring that the computation works.\n  std::cout \u003c\u003c \"Result of gemm: \" \u003c\u003c (*c) \u003c\u003c std::endl;\n\n  return 0;\n}\n```\n\n#### Usage with AlexNet\n```cpp\n#include \u003cmodularml\u003e\n#include \u003cmemory\u003e\n#include \u003ciostream\u003e\n#include \u003cfstream\u003e\n\nint main() {\n  /* Load the json file that has been created by onnx2json, that script can be downloaded externally\n  Or you can use the one thats found in build/_deps/modularml-src/onnx2json */\n  std::ifstream file(\"../src/alexnet_trained.json\");\n  nlohmann::json json_model;\n  file \u003e\u003e json_model;\n  file.close();\n  // Parse the model into a model object, containing all the nodes.\n  auto parser = Parser_mml();\n  auto model = parser.parse(json_model);\n  // Create an input tensor thats empty\n  auto input = TensorFactory::create_tensor\u003cfloat\u003e({1, 3, 224, 224});\n  // Create an input map\n  std::unordered_map\u003cstd::string, GeneralDataTypes\u003e input_map;\n  input_map[\"input\"] = input;\n  // Run inference with the input map\n  auto output_map = model-\u003einfer(input_map);\n  // Get the output\n  auto output = std::get_if\u003cstd::shared_ptr\u003cTensor\u003cfloat\u003e\u003e\u003e(\u0026(output_map[\"output\"]));\n  // Extract the output tensor and print it!\n  std::cout \u003c\u003c \"Output: \" \u003c\u003c (*output) \u003c\u003c std::endl;\n  return 0;\n}\n```\n\n### Contributing\nWe welcome contributions!  \nPlease read our [Contributing Guide](CONTRIBUTING.md) for instructions on how to get started.\n\n### License\nThis project is licensed under the [MIT License](LICENSE).\n\n### Acknowledgments\nThis library is a fork from the framework that was developed as part of a Bachelor Thesis at Chalmers University of Technology. Which can be found [here](https://github.com/willayy/modularml)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillayy%2Fmodularml-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillayy%2Fmodularml-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillayy%2Fmodularml-lib/lists"}