Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion neural_compressor/contrib/strategy/sigopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ def __init__(self, model, conf, q_dataloader, q_func=None,
try:
import sigopt
except ImportError:
ImportError(f"Please install sigopt for using {strategy_name} strategy.")
try:
import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "sigopt"])
import sigopt # pylint: disable=import-error
except:
assert False, "Unable to import sigopt from the local environment."
else:
pass
# SigOpt init
Expand Down
8 changes: 7 additions & 1 deletion neural_compressor/contrib/strategy/tpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ def __init__(self, model, conf, q_dataloader, q_func=None,
try:
import hyperopt
except ImportError:
raise ImportError(f"Please install hyperopt for using {strategy_name} strategy.")
try:
import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "hyperopt"])
import hyperopt # pylint: disable=import-error
except:
assert False, "Unable to import hyperopt from the local environment."
else:
pass
self.hpopt_search_space = None
Expand Down
2 changes: 0 additions & 2 deletions test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pillow>=8.2.0
transformers<=4.12.3; python_version < '3.10'
transformers==4.16.0; python_version == '3.10'
tensorflow_model_optimization
sigopt
hyperopt
horovod
tensorflow-addons
onnxruntime-extensions; python_version < '3.10'
Expand Down