Improve exception type.

ImportError isn't really appropriate when there's no import involved.
This commit is contained in:
Aymeric Augustin
2019-12-23 21:23:08 +01:00
parent 4c09a96096
commit c8b0c1e551
5 changed files with 7 additions and 7 deletions

View File

@@ -107,7 +107,7 @@ class ServeCommand(BaseTransformersCLICommand):
self._host = host
self._port = port
if not _serve_dependancies_installed:
raise ImportError(
raise RuntimeError(
"Using serve command requires FastAPI and unicorn. "
"Please install transformers with [serving]: pip install transformers[serving]."
"Or install FastAPI and unicorn separatly."

View File

@@ -8,7 +8,7 @@ from transformers.commands import BaseTransformersCLICommand
if not is_tf_available() and not is_torch_available():
raise ImportError("At least one of PyTorch or TensorFlow 2.0+ should be installed to use CLI training")
raise RuntimeError("At least one of PyTorch or TensorFlow 2.0+ should be installed to use CLI training")
# TF training parameters
USE_XLA = False