build: check for torch version at runtime (fixes #329)

pull/335/head
Bryce 1 year ago committed by Bryce Drennan
parent 758d574f8c
commit e53459a50a

@ -495,7 +495,8 @@ A: The AI models are cached in `~/.cache/` (or `HUGGINGFACE_HUB_CACHE`). To dele
- fix: hide the "triton" error messages
- fix: package will not try to install xformers on `aarch64` machines. While this will allow the dockerfile to build on
MacOS M1, [torch will not be able to use the M1 when generating images.](https://github.com/pytorch/pytorch/issues/81224#issuecomment-1499741152)
- build: specify proper Pillow minimum version (fixes #325)
- build: specify proper Pillow minimum version (fixes #325)
- build: check for torch version at runtime (fixes #329)
**12.0.3**
- fix: exclude broken versions of timm as dependencies

@ -143,12 +143,15 @@ def imagine(
from imaginairy.schema import ImaginePrompt
from imaginairy.utils import (
check_torch_version,
fix_torch_group_norm,
fix_torch_nn_layer_norm,
get_device,
platform_appropriate_autocast,
)
check_torch_version()
prompts = [ImaginePrompt(prompts)] if isinstance(prompts, str) else prompts
prompts = [prompts] if isinstance(prompts, ImaginePrompt) else prompts

@ -236,3 +236,15 @@ def get_next_filenumber(path):
last_file_num = 0
return max(file_count, last_file_num + 1)
def check_torch_version():
"""
Check that the torch version is compatible with ImaginAIry.
https://github.com/brycedrennan/imaginAIry/issues/329
"""
from packaging import version
if version.parse(torch.__version__) >= version.parse("2.0.0"):
raise RuntimeError("ImaginAIry is not compatible with torch>=2.0.0")

Loading…
Cancel
Save