{"id":20121211,"url":"https://github.com/iree-org/iree-turbine","last_synced_at":"2025-05-16T12:08:47.051Z","repository":{"id":235038168,"uuid":"789940696","full_name":"iree-org/iree-turbine","owner":"iree-org","description":"IREE's PyTorch Frontend, based on Torch Dynamo.","archived":false,"fork":false,"pushed_at":"2025-04-09T19:36:02.000Z","size":2459,"stargazers_count":76,"open_issues_count":118,"forks_count":47,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-04-09T19:41:27.562Z","etag":null,"topics":["compiler","machine-learning","mlir","pytorch","runtime"],"latest_commit_sha":null,"homepage":"https://iree.dev/guides/ml-frameworks/pytorch/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iree-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"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}},"created_at":"2024-04-22T00:33:14.000Z","updated_at":"2025-04-08T21:30:08.000Z","dependencies_parsed_at":"2024-05-18T01:43:08.569Z","dependency_job_id":"f4247357-cb44-42ac-8f6b-9af42b256ade","html_url":"https://github.com/iree-org/iree-turbine","commit_stats":null,"previous_names":["iree-org/iree-turbine"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iree-org%2Firee-turbine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iree-org%2Firee-turbine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iree-org%2Firee-turbine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iree-org%2Firee-turbine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iree-org","download_url":"https://codeload.github.com/iree-org/iree-turbine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248545522,"owners_count":21122155,"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":["compiler","machine-learning","mlir","pytorch","runtime"],"created_at":"2024-11-13T19:26:33.480Z","updated_at":"2025-04-12T09:27:35.010Z","avatar_url":"https://github.com/iree-org.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IREE Turbine\n\n[![PyPI version](https://badge.fury.io/py/iree-turbine.svg)](https://badge.fury.io/py/iree-turbine)\n[![Documentation status](https://readthedocs.org/projects/iree-turbine/badge/?version=latest)](https://app.readthedocs.org/projects/iree-turbine/builds/?version__slug=latest)\n\n\u003cimg src=\"https://netl.doe.gov/sites/default/files/2020-11/Turbine-8412270026_83cfc8ee8f_c.jpg\" height=\"300px\" width=\"300px\"\u003e\n\nTurbine is [IREE's](https://iree.dev/) frontend for\n[PyTorch](https://pytorch.org/).\n\nTurbine provides a collection of tools:\n\n* *AOT Export*: For compiling one or more `nn.Module`s to compiled, deployment\n  ready artifacts. This operates via both a simple one-shot export API\n  (also available via\n  [torch-mlir](https://github.com/llvm/torch-mlir/blob/main/python/torch_mlir/extras/fx_importer.py))\n  for simple models and an underlying\n  [advanced API](https://github.com/iree-org/iree-turbine/blob/main/iree/turbine/aot/compiled_module.py)\n  for complicated models and accessing the full features of the runtime.\n* *Eager Execution*: A `torch.compile` backend is provided and a Turbine Tensor/Device\n  is available for more native, interactive use within a PyTorch session.\n* *Custom Ops*: Integration for defining custom PyTorch ops and implementing them in\n  terms of IREE's backend IR or a Pythonic kernel language.\n\n## Documentation\n\n* API reference pages and project documentation: https://iree-turbine.readthedocs.io/\n* Guides for using Turbine as a bridge between PyTorch and IREE:\n  https://iree.dev/guides/ml-frameworks/pytorch/\n\n## Contact us\n\nTurbine is under active development. Feel free to reach out on one of\n[IREE's communication channels](https://github.com/iree-org/iree?tab=readme-ov-file#communication-channels)\n(specifically, we monitor the `#pytorch` and `#turbine` channels on the IREE\nDiscord server).\n\n## Quick start for users\n\n1. Install from PyPI:\n\n    Install a torch version that fulfills your needs:\n\n    ```bash\n    # Fast installation of torch with just CPU support.\n    # See other options at https://pytorch.org/get-started/locally/\n    pip install torch --index-url https://download.pytorch.org/whl/cpu\n    ```\n\n    Then install iree-turbine:\n\n    ```bash\n    # Stable releases\n    pip install iree-turbine\n\n    # Nightly releases\n    pip install --find-links https://iree.dev/pip-release-links.html --upgrade --pre iree-turbine\n    ```\n\n    (or follow the \"Developers\" instructions below)\n\n2. Try one of the [examples](https://github.com/iree-org/iree-turbine/blob/main/examples/):\n\n    * [AOT MLP With Static Shapes](https://github.com/iree-org/iree-turbine/blob/main/examples/aot_mlp/mlp_export_simple.py)\n    * [Eager MNIST with `torch.compile`](https://github.com/iree-org/iree-turbine/blob/main/examples/eager_mlp/mlp_eager_simple.py)\n    * [Dynamic AOT resnet-18](https://github.com/iree-org/iree-turbine/blob/main/examples/resnet-18/)\n\n    Generally, we use Turbine to produce valid, dynamic shaped Torch IR (from the\n    [torch-mlir `torch` dialect](https://github.com/llvm/torch-mlir/tree/main/include/torch-mlir/Dialect/Torch/IR)\n    with various approaches to handling globals). Depending on the use-case and status of the\n    compiler, these should be compilable via IREE with `--iree-input-type=torch` for\n    end to end execution. Dynamic shape support in torch-mlir is a work in progress,\n    and not everything works at head with release binaries at present.\n\n## Developers\n\nUse this as a guide to get started developing the project using pinned,\npre-release dependencies. You are welcome to deviate as you see fit, but\nthese canonical directions mirror what the CI does.\n\n### Setup a venv\n\nWe recommend setting up a\n[virtual environment (venv)](https://docs.python.org/3/library/venv.html). The\nproject is configured to ignore `.venv` directories, and editors like VSCode\npick them up by default.\n\n```bash\npython -m venv --prompt iree-turbine .venv\nsource .venv/bin/activate\n```\n\n### Install PyTorch for your system\n\nYou need to explicit install a PyTorch version that fulfills your needs.\nOn Linux, install a variant by either following the\n[official instructions](https://pytorch.org/get-started/locally/) or by using\none of our `requirements.txt` files:\n\n* *CPU: [`pytorch-cpu-requirements.txt`](https://github.com/iree-org/iree-turbine/blob/main/pytorch-cpu-requirements.txt)*\n\n  ```bash\n  pip install -r pytorch-cpu-requirements.txt\n  ```\n\n* *ROCM: [`pytorch-rocm-requirements.txt`](https://github.com/iree-org/iree-turbine/blob/main/pytorch-rocm-requirements.txt)*\n\n  ```bash\n  pip install -r pytorch-rocm-requirements.txt\n  ```\n\n### Install development packages\n\n```bash\n# Install editable local projects.\npip install -r requirements.txt -e .\n```\n\n### Running tests\n\n```bash\n# Python unit tests\npytest .\n\n# Lit tests\nlit lit_tests/ -v\n```\n\n### Optional: Pre-commits and developer settings\n\nThis project is set up to use the [`pre-commit`](https://pre-commit.com/)\ntooling. To install it in your local repo, run: `pre-commit install`. After\nthis point, when making commits locally, hooks will run automatically.\n\n### Using a development compiler\n\nIf doing native development of the compiler, it can be useful to switch to\nsource builds for the\n[iree-base-compiler](https://pypi.org/project/iree-base-compiler/) and\n[iree-base-runtime](https://pypi.org/project/iree-base-runtime/) packages.\n\nIn order to do this, check out [IREE](https://github.com/iree-org/iree) and\nfollow the instructions to\n[build from source](https://iree.dev/building-from-source/getting-started/),\nmaking sure to specify\n[additional options for the Python bindings](https://iree.dev/building-from-source/getting-started/#building-with-cmake):\n\n```bash\n-DIREE_BUILD_PYTHON_BINDINGS=ON -DPython3_EXECUTABLE=\"$(which python)\"\n```\n\n#### Configuring python\n\nUninstall existing packages (including any with the old package names):\n\n```bash\npip uninstall iree-compiler iree-base-compiler iree-runtime iree-base-runtime\n```\n\nCopy the `.env` file from `iree/` to this source directory to get IDE\nsupport and add to your path for use from your shell:\n\n```bash\nsource .env \u0026\u0026 export PYTHONPATH\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firee-org%2Firee-turbine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firee-org%2Firee-turbine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firee-org%2Firee-turbine/lists"}