hpcaitech / EnergonAI

Large-scale model inference.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing energonai_linear_func in setup.py

xgreat8 opened this issue · comments

Problem

[root@2e71bfd17f96 inference]# export PYTHONPATH=/workspace/colossal/inference/examples/bert
[root@2e71bfd17f96 inference]# energonai service init --config_file=/workspace/colossal/inference/examples/bert/bert_config.py
Traceback (most recent call last):
  File “/opt/conda/lib/python3.9/site-packages/energonai/kernel/cuda_native/linear_func.py”, line 5, in <module>
    energonai_linear = importlib.import_module(“energonai_linear_func”)
  File “/opt/conda/lib/python3.9/importlib/__init__.py”, line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File “<frozen importlib._bootstrap>“, line 1030, in _gcd_import
  File “<frozen importlib._bootstrap>“, line 1007, in _find_and_load
  File “<frozen importlib._bootstrap>“, line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘energonai_linear_func’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File “/opt/conda/bin/energonai”, line 8, in <module>
    sys.exit(typer_click_object())
  File “/opt/conda/lib/python3.9/site-packages/click/core.py”, line 1130, in __call__
    return self.main(*args, **kwargs)
  File “/opt/conda/lib/python3.9/site-packages/typer/core.py”, line 778, in main
    return _main(
  File “/opt/conda/lib/python3.9/site-packages/typer/core.py”, line 216, in _main
    rv = self.invoke(ctx)
  File “/opt/conda/lib/python3.9/site-packages/click/core.py”, line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File “/opt/conda/lib/python3.9/site-packages/click/core.py”, line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File “/opt/conda/lib/python3.9/site-packages/click/core.py”, line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File “/opt/conda/lib/python3.9/site-packages/click/core.py”, line 760, in invoke
    return __callback(*args, **kwargs)
  File “/opt/conda/lib/python3.9/site-packages/energonai/cli/service.py”, line 19, in init
    mcfg.load_config(config_file)
  File “/opt/conda/lib/python3.9/site-packages/energonai/context/config.py”, line 161, in load_config
    self._config = Config.from_file(config)
  File “/opt/conda/lib/python3.9/site-packages/energonai/context/config.py”, line 105, in from_file
    module = source_file.load_module()
  File “<frozen importlib._bootstrap_external>“, line 529, in _check_name_wrapper
  File “<frozen importlib._bootstrap_external>“, line 1029, in load_module
  File “<frozen importlib._bootstrap_external>“, line 854, in load_module
  File “<frozen importlib._bootstrap>“, line 274, in _load_module_shim
  File “<frozen importlib._bootstrap>“, line 711, in _load
  File “<frozen importlib._bootstrap>“, line 680, in _load_unlocked
  File “<frozen importlib._bootstrap_external>“, line 850, in exec_module
  File “<frozen importlib._bootstrap>“, line 228, in _call_with_frames_removed
  File “/workspace/colossal/inference/examples/bert/bert_config.py”, line 1, in <module>
    from bert import bert_small, bert_large, bert_xl, bert_8B, bert_175B
  File “/workspace/colossal/inference/examples/bert/bert.py”, line 14, in <module>
    from energonai.kernel import transpose_pad, transpose_depad, depad
  File “/opt/conda/lib/python3.9/site-packages/energonai/kernel/__init__.py”, line 1, in <module>
    from .cuda_native import transpose_pad, transpose_depad, depad, scale_mask_softmax
  File “/opt/conda/lib/python3.9/site-packages/energonai/kernel/cuda_native/__init__.py”, line 5, in <module>
    from .linear_func import EnergonLinearFunc
  File “/opt/conda/lib/python3.9/site-packages/energonai/kernel/cuda_native/linear_func.py”, line 7, in <module>
    raise RuntimeError(‘energonai_linear_func requires cuda extensions’)
RuntimeError: energonai_linear_func requires cuda extensions

Root cause
Found the root cause — missing following in setup.py:

        ext_modules.append(cuda_ext_helper('energonai_linear_func',
                                           ['linear_wrapper.cpp'],
                                           extra_cuda_flags + cc_flag))
commented

I push this commit by mistake.😂 EnergonAI will have a big update recently.