mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[tune] explicitly raising tune import Error “[tune]” (#16575)
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
This commit is contained in:
parent
0935ec30d0
commit
e3966f59e3
1 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -7,8 +8,10 @@ TuneGridSearchCV = None
|
|||
|
||||
try:
|
||||
from tune_sklearn import TuneSearchCV, TuneGridSearchCV
|
||||
except ImportError:
|
||||
logger.info("tune_sklearn is not installed. Please run "
|
||||
"`pip install tune-sklearn`.")
|
||||
|
||||
except ImportError as exc:
|
||||
# Changed in 1.5.0 -- Raises an exception instead of returning None.
|
||||
tb = sys.exc_info()[2]
|
||||
msg = ("Tune's Scikit-Learn bindings (tune-sklearn) is not installed. "
|
||||
"Please run `pip install tune-sklearn`.")
|
||||
raise type(exc)().with_traceback(tb) from None
|
||||
__all__ = ["TuneSearchCV", "TuneGridSearchCV"]
|
||||
|
|
Loading…
Add table
Reference in a new issue