ModuleNotFoundError: No module named 'fast_multihead_attn'
Describe the Bug after I install apex, "import apex.contrib.multihead_attn"produce this bug Minimal Steps/Code to Reproduce the Bug
- just install apex by using this command:
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./ - "import apex.contrib.multihead_attn"
Expected Behavior
no bug occur
Environment
os:ubuntu python:3.10.6 cuda:11.6 pytorch:1.12.1
my pip version is 22.1. it seems it is the pyproject.toml that influence pip install
when the pyproject.toml exists, the setup.py can not receive the arguments that we set, e.g --global-option="--cpp_ext" --global-option="--cuda_ext".
Because the missing arguments --fast_multihead_attn for setup.py, the extension multihead_attn is not built, producing bug when using import apex.contrib.multihead_attn
The relationship between pyproject.toml and setup.py can be found in Build System Interface
wouldn't python setup.py install --fast_multihead_attn work?
wouldn't
python setup.py install --fast_multihead_attnwork?
I have tried python setup.py install --fast_multihead_attn, it cause another build problem.
It seems like that pip install consider pyproject.toml firstly to build apex, and then try setup.py, so setup.py can not receive the arguments.
git clone https://github.com/NVIDIA/apex.git
cd apex git branch -a git checkout -b 22.04-dev origin/22.04-dev
pip uninstall apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--fast_multihead_attn" ./