diff --git a/README.md b/README.md index e1ecc78..468d5c6 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,15 @@ open docs/_build/html/index.html ## Development +### Setting up pre-commit hooks + +This repo uses [pre-commit](https://pre-commit.com) to run linting and +formatting checks automatically. Install the hooks once after cloning: + +```bash +pre-commit install --hook-type pre-commit --hook-type pre-push +``` + ### Running tests ```bash diff --git a/coreai_torch/__init__.py b/coreai_torch/__init__.py index b941ca4..b420d9d 100644 --- a/coreai_torch/__init__.py +++ b/coreai_torch/__init__.py @@ -5,8 +5,12 @@ """coreai-torch: Convert PyTorch models to Core AI format.""" +import warnings as _warnings + # Re-export MetalParameter so users don't need a separate coreai import. from coreai.authoring import MetalParameter +from packaging.version import Version as _Version +from torch import __version__ as _torch_version from .__version__ import __version__ from ._composite_declaration import generate_composite_decl @@ -24,3 +28,12 @@ "get_decomp_table", "generate_composite_decl", ] + +_TORCH_MAX_VERSION = "2.13.0" + +if _Version(_torch_version) > _Version(_TORCH_MAX_VERSION): + _warnings.warn( + f"coreai-torch has only been validated with torch<={_TORCH_MAX_VERSION}; " + f"found torch {_torch_version}. Some functionality may not work as expected.", + stacklevel=2, + ) diff --git a/pyproject.toml b/pyproject.toml index d45e244..1cdd106 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ dependencies = [ "packaging", "scipy", "sympy", - "torch>=2.8.0,<=2.13.0", + "torch>=2.8.0", "typing-extensions", "strenum", "rich>=13.0,<16.0", @@ -38,8 +38,9 @@ test = [ "pytest-rerunfailures", "pytest-sugar", "pytest-xdist", - "torchaudio", - "torchvision", + "torch==2.13.0", + "torchaudio==2.11.0", + "torchvision==0.28.0", "transformers==4.57.3", ] docs = [