Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

disable accelerate for macos and pytorch 1.10.2 (#1811)

Edgar Ribae81e0ff68f0c
diff --git a/kornia/x/trainer.py b/kornia/x/trainer.py
index 070d76415..1ecf9ba2f 100644
--- a/kornia/x/trainer.py
+++ b/kornia/x/trainer.py
@@ -1,12 +1,12 @@
import logging
from typing import Callable, Dict, Optional
+# the accelerator library is a requirement for the Trainer
+# but it is optional for grousnd base user of kornia.
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
-# the accelerator library is a requirement for the Trainer
-# but it is optional for grousnd base user of kornia.
try:
from accelerate import Accelerator
except ImportError:
diff --git a/setup_dev_env.sh b/setup_dev_env.sh
index 7f5cd0b3a..29fddcd7d 100755
--- a/setup_dev_env.sh
+++ b/setup_dev_env.sh
@@ -36,7 +36,7 @@ fi
# define a python version to initialise the conda environment.
# by default we assume python 3.7.
python_version=${PYTHON_VERSION:-"3.7"}
-pytorch_version=${PYTORCH_VERSION:-"1.10.1"}
+pytorch_version=${PYTORCH_VERSION:-"1.10.2"}
pytorch_mode=${PYTORCH_MODE:-""} # use `cpuonly` for CPU or leave it in blank for GPU
cuda_version=${CUDA_VERSION:-"10.2"}
diff --git a/test/x/__init__.py b/test/x/__init__.py
new file mode 100644
index 000000000..fb6f908a1
--- /dev/null
+++ b/test/x/__init__.py
@@ -0,0 +1,10 @@
+import sys
+
+import pytest
+
+from kornia.utils._compat import torch_version
+
+# NOTE: remove once we deprecate pytorch 1.10.2 for macos
+
+if sys.platform == "darwin" and torch_version() == "1.10.2":
+ pytest.skip("Accelerate is broken for macos and pytorch 1.10.2", allow_module_level=True)