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."