From ad4ca1977541609d78e88e8175f9d103020d50d2 Mon Sep 17 00:00:00 2001 From: Phil Wang Date: Mon, 8 May 2023 09:34:14 -0700 Subject: [PATCH] enforce latest einops --- setup.py | 4 ++-- vit_pytorch/__init__.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3e66aeda..308c818f 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'vit-pytorch', packages = find_packages(exclude=['examples']), - version = '1.2.0', + version = '1.2.1', license='MIT', description = 'Vision Transformer (ViT) - Pytorch', long_description_content_type = 'text/markdown', @@ -16,7 +16,7 @@ 'image recognition' ], install_requires=[ - 'einops>=0.6.0', + 'einops>=0.6.1', 'torch>=1.10', 'torchvision' ], diff --git a/vit_pytorch/__init__.py b/vit_pytorch/__init__.py index d6ed9064..72f77f3a 100644 --- a/vit_pytorch/__init__.py +++ b/vit_pytorch/__init__.py @@ -1,3 +1,10 @@ +import torch +from packaging import version + +if version.parse(torch.__version__) >= version.parse('2.0.0'): + from einops._torch_specific import allow_ops_in_compiled_graph + allow_ops_in_compiled_graph() + from vit_pytorch.vit import ViT from vit_pytorch.simple_vit import SimpleViT