{"id":15637888,"url":"https://github.com/ankane/onnxruntime-ruby","last_synced_at":"2025-11-17T14:07:09.423Z","repository":{"id":50371561,"uuid":"204581401","full_name":"ankane/onnxruntime-ruby","owner":"ankane","description":"Run ONNX models in Ruby","archived":false,"fork":false,"pushed_at":"2025-09-30T18:23:57.000Z","size":14486,"stargazers_count":145,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-11-11T10:06:39.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-08-26T23:51:36.000Z","updated_at":"2025-11-07T07:46:31.000Z","dependencies_parsed_at":"2023-12-27T18:39:36.959Z","dependency_job_id":"cbd82ccf-62fa-4987-9d8e-c795b99e613b","html_url":"https://github.com/ankane/onnxruntime-ruby","commit_stats":{"total_commits":323,"total_committers":4,"mean_commits":80.75,"dds":"0.43034055727554177","last_synced_commit":"5a56d0a90297b7bab74fc0a83068c84b69a7e860"},"previous_names":["ankane/onnxruntime"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/onnxruntime-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fonnxruntime-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fonnxruntime-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fonnxruntime-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fonnxruntime-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/onnxruntime-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fonnxruntime-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284082483,"owners_count":26944315,"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","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"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":"2024-10-03T11:14:30.083Z","updated_at":"2025-11-17T14:07:09.407Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# ONNX Runtime Ruby\n\n:fire: [ONNX Runtime](https://github.com/Microsoft/onnxruntime) - the high performance scoring engine for ML models - for Ruby\n\nCheck out [an example](https://ankane.org/tensorflow-ruby)\n\nFor transformer models, check out [Informers](https://github.com/ankane/informers)\n\n[![Build Status](https://github.com/ankane/onnxruntime-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/onnxruntime-ruby/actions)\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"onnxruntime\"\n```\n\n## Getting Started\n\nLoad a model and make predictions\n\n```ruby\nmodel = OnnxRuntime::Model.new(\"model.onnx\")\nmodel.predict({x: [1, 2, 3]})\n```\n\n\u003e Download pre-trained models from the [ONNX Model Zoo](https://github.com/onnx/models)\n\nGet inputs\n\n```ruby\nmodel.inputs\n```\n\nGet outputs\n\n```ruby\nmodel.outputs\n```\n\nGet metadata\n\n```ruby\nmodel.metadata\n```\n\nLoad a model from a string or other `IO` object\n\n```ruby\nio = StringIO.new(\"...\")\nmodel = OnnxRuntime::Model.new(io)\n```\n\nGet specific outputs\n\n```ruby\nmodel.predict({x: [1, 2, 3]}, output_names: [\"label\"])\n```\n\n## Session Options\n\n```ruby\nOnnxRuntime::Model.new(\n  path_or_io,\n  enable_cpu_mem_arena: true,\n  enable_mem_pattern: true,\n  enable_profiling: false,\n  execution_mode: :sequential,    # :sequential or :parallel\n  free_dimension_overrides_by_denotation: nil,\n  free_dimension_overrides_by_name: nil,\n  graph_optimization_level: nil,  # :none, :basic, :extended, or :all\n  inter_op_num_threads: nil,\n  intra_op_num_threads: nil,\n  log_severity_level: 2,\n  log_verbosity_level: 0,\n  logid: nil,\n  optimized_model_filepath: nil,\n  profile_file_prefix: \"onnxruntime_profile_\",\n  session_config_entries: nil\n)\n```\n\n## Run Options\n\n```ruby\nmodel.predict(\n  input_feed,\n  output_names: nil,\n  log_severity_level: 2,\n  log_verbosity_level: 0,\n  logid: nil,\n  terminate: false,\n  output_type: :ruby       # :ruby or :numo\n)\n```\n\n## Inference Session API\n\nYou can also use the Inference Session API, which follows the [Python API](https://onnxruntime.ai/docs/api/python/api_summary.html).\n\n```ruby\nsession = OnnxRuntime::InferenceSession.new(\"model.onnx\")\nsession.run(nil, {x: [1, 2, 3]})\n```\n\nThe Python example models are included as well.\n\n```ruby\nOnnxRuntime::Datasets.example(\"sigmoid.onnx\")\n```\n\n## GPU Support\n\n### Linux and Windows\n\nDownload the appropriate [GPU release](https://github.com/microsoft/onnxruntime/releases) and set:\n\n```ruby\nOnnxRuntime.ffi_lib = \"path/to/lib/libonnxruntime.so\" # onnxruntime.dll for Windows\n```\n\nand use:\n\n```ruby\nmodel = OnnxRuntime::Model.new(\"model.onnx\", providers: [\"CUDAExecutionProvider\"])\n```\n\n### Mac\n\nUse:\n\n```ruby\nmodel = OnnxRuntime::Model.new(\"model.onnx\", providers: [\"CoreMLExecutionProvider\"])\n```\n\n## History\n\nView the [changelog](https://github.com/ankane/onnxruntime-ruby/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/onnxruntime-ruby/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/onnxruntime-ruby/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development and testing:\n\n```sh\ngit clone https://github.com/ankane/onnxruntime-ruby.git\ncd onnxruntime-ruby\nbundle install\nbundle exec rake vendor:all\nbundle exec rake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fonnxruntime-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Fonnxruntime-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fonnxruntime-ruby/lists"}