Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions coreai_torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -38,8 +38,9 @@ test = [
"pytest-rerunfailures",
"pytest-sugar",
"pytest-xdist",
"torchaudio",
"torchvision",
"torch==2.13.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if you plan to test on different torch versions, you could move the torch dependencies to a different dependency group and then "import" it into this group by doing { include-group = ... }

"torchaudio==2.11.0",
"torchvision==0.28.0",
"transformers==4.57.3",
]
docs = [
Expand Down