зеркало из https://github.com/microsoft/DeepSpeed.git
setup: add method to abort from fatal error
This commit is contained in:
Родитель
afc559c8c4
Коммит
0e4cde6b0a
11
setup.py
11
setup.py
|
@ -33,6 +33,15 @@ except ImportError:
|
|||
|
||||
from op_builder import ALL_OPS, get_default_compute_capatabilities
|
||||
|
||||
RED_START = '\033[31m'
|
||||
RED_END = '\033[0m'
|
||||
ERROR = f"{RED_START} [ERROR] {RED_END}"
|
||||
|
||||
|
||||
def abort(msg):
|
||||
print(f"{ERROR} {msg}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def fetch_requirements(path):
|
||||
with open(path, 'r') as fd:
|
||||
|
@ -123,7 +132,7 @@ for op_name, builder in ALL_OPS.items():
|
|||
env_var = op_envvar(op_name)
|
||||
if env_var not in os.environ:
|
||||
builder.warning(f"One can disable {op_name} with {env_var}=0")
|
||||
assert False, f"Unable to pre-compile {op_name}"
|
||||
abort(f"Unable to pre-compile {op_name}")
|
||||
|
||||
# If op is compatible update install reqs so it can potentially build/run later
|
||||
if op_compatible:
|
||||
|
|
Загрузка…
Ссылка в новой задаче