Skip to content

Commit 933473e

Browse files
committed
Fix the torch and transformers import issue
1 parent d552d29 commit 933473e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

logai/algorithms/factory.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,9 @@ def unregister(cls, task, name):
6666

6767
def _check_algorithm(self, task, name):
6868
if name in self._algorithms_with_torch:
69-
if not is_torch_available():
70-
raise ImportError("Python lib torch is not installed, "
71-
"please install it via `pip install torch`.")
72-
if not is_transformers_available():
73-
raise ImportError("Python lib transformers is not installed, "
74-
"please install it via `pip install transformers`.")
69+
if not is_torch_available() or not is_transformers_available():
70+
raise ImportError("Some deep learning packages are missing. "
71+
"Please install them via `pip install logai[deep-learning]`.")
7572
assert name in self._algorithms[task], \
7673
f"Unknown algorithm {name}, please choose from {self._algorithms[task].keys()}."
7774

0 commit comments

Comments
 (0)