diff --git a/README.md b/README.md index 182aca1bc..b97190c68 100644 --- a/README.md +++ b/README.md @@ -32,21 +32,22 @@ Discord server). 1. Install from PyPI: - ```bash - # Stable releases - pip install iree-turbine + Install a torch version that fulfills your needs: - # Nightly releases - pip install --find-links https://iree.dev/pip-release-links.html --upgrade --pre iree-turbine + ```bash + # Fast installation of torch with just CPU support. + # See other options at https://pytorch.org/get-started/locally/ + pip install torch --index-url https://download.pytorch.org/whl/test/cpu ``` - The above does install some CUDA/cuDNN packages which are unnecessary for most - usage. To avoid this you can - [install just pytorch-cpu](https://pytorch.org/get-started/locally/) via: + Then install iree-turbine: ```bash - pip install -r pytorch-cpu-requirements.txt + # Stable releases pip install iree-turbine + + # Nightly releases + pip install --find-links https://iree.dev/pip-release-links.html --upgrade --pre iree-turbine ``` (or follow the "Developers" instructions below) @@ -84,9 +85,8 @@ source .venv/bin/activate ### Install PyTorch for your system -If no explicit action is taken, the default PyTorch version will be installed. -On Linux this may give you a current CUDA-based version. Install a different -variant by doing so explicitly first, either by following the +You need to explicit install a PyTorch version that fulfills your needs. +On Linux, install a variant by either following the [official instructions](https://pytorch.org/get-started/locally/) or by using one of our `requirements.txt` files: diff --git a/iree/turbine/__init__.py b/iree/turbine/__init__.py index d95aa54ff..af5b2501f 100644 --- a/iree/turbine/__init__.py +++ b/iree/turbine/__init__.py @@ -8,3 +8,13 @@ # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +import importlib.util + +msg = """No module named 'torch'. Follow https://pytorch.org/get-started/locally/#start-locally to install 'torch'. +For example, on Linux to install with CPU support run: + pip3 install torch --index-url https://download.pytorch.org/whl/cpu +""" + +if spec := importlib.util.find_spec("torch") is None: + raise ModuleNotFoundError(msg) diff --git a/setup.py b/setup.py index 5a94d24eb..cd5a91a8b 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,6 @@ def initialize_options(self): f"numpy{get_version_spec('numpy')}", f"iree-base-compiler{get_version_spec('iree-base-compiler')}", f"iree-base-runtime{get_version_spec('iree-base-runtime')}", - "torch>=2.3.0", f"Jinja2{get_version_spec('Jinja2')}", f"ml_dtypes{get_version_spec('ml_dtypes')}", f"typing_extensions{get_version_spec('typing_extensions')}",