thomasbrandon / mish-cuda

Mish Activation Function for PyTorch
MIT License
147 stars 67 forks source link

pytorch1.6 cuda10.2 #5

Open xiaozhangya opened 3 years ago

xiaozhangya commented 3 years ago

pytorch1.6 cuda10.2 Can this be installed?

Bendabir commented 3 years ago

Yes. I did it. As the library is not on PyPI, you however need to build it yourself.

First install PyTorch 1.6.0 (best in a virtual env) and CUDA 10.2. Make the LD_LIBRARY_PATH point to /usr/local/cuda-10.2/lib64:/usr/local/cuda-10.2/extras/CUPTI/lib64 if not already done. If you have multiple versions of CUDA, do not forget to reset the env variable to its initial value to avoid issues with other projects that would need the default CUDA version installed on your machine. You could also add /usr/local/cuda-10.2/bin to the PATH variable but I'm not sure it's mandatory nor useful.

Then, from the mish-cuda repository, run python setup.py sdist bdist_wheel to build a Wheel file (located in ./dist). You can now either send the Wheel file to your own PyPI instance or just install it in one of your project (with pip install).

Hope this helps.

thomasbrandon commented 3 years ago

Just setting LD_LIBRARY_PATH will not properly select the CUDA toolkit if you have multiple versions. PyTorch uses the CUDA_HOME/CUDA_PATH environment variables to locate the CUDA headers and tools. Mismatches between the headers used in compilation and libraries will cause various issues that are hard to diagnose. So make sure those are properly set as well. Or better yet just don't mix CUDA versions.

Also you can just use pip install git+https://github.com/thomasbrandon/mish-cuda/ to install straight from git without needing to create wheels.

STAROFWIND commented 3 years ago

Hi, I use torch=1.6. I use "pip install git+https://github.com/thomasbrandon/mish-cuda/" to install mish-cuda. But it give me an error like: ERROR: Command errored out with exit status 1: command: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y5wm_mdb

and ERROR: Failed building wheel for mish-cuda and ERROR: Command errored out with exit status 1: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ivpj2a53/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ducnm/.local/include/python3.6m/mish-cuda Check the logs for full command output.

How can I solve them? Thanks !

DrewdropLife commented 3 years ago

@thomasbrandon hi,when I try pip install git+https://github.com/thomasbrandon/mish-cuda/or python setup.py -v build , it failed. my torch=1.6.0+cu101 torchvision=0.7.0+cu101 How to solve this problem? 2020-12-30 14-48-55 的屏幕截图

thomasbrandon commented 3 years ago

@changxinC This is related to an incompatability between your system C++ compiler and your CUDA version, It's apparently fixed in CUDA 10.1.168 (according to this). Otherwise upgrading/downgrading your system C++ compiler may fix. Exactly which is easiest will depend a on your distro.

DrewdropLife commented 3 years ago

@changxinC This is related to an incompatability between your system C++ compiler and your CUDA version, It's apparently fixed in CUDA 10.1.168 (according to this). Otherwise upgrading/downgrading your system C++ compiler may fix. Exactly which is easiest will depend a on your distro.

Oh thanks, my CUDA is 10.1.105, g++ is 7.6.5, maybe I need to update the CUDA version.

wuy66 commented 3 years ago

Hi, I use torch=1.6. I use "pip install git+https://github.com/thomasbrandon/mish-cuda/" to install mish-cuda. But it give me an error like: ERROR: Command errored out with exit status 1: command: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y5wm_mdb

and ERROR: Failed building wheel for mish-cuda and ERROR: Command errored out with exit status 1: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ivpj2a53/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ducnm/.local/include/python3.6m/mish-cuda Check the logs for full command output.

How can I solve them? Thanks !

I got the same problem. Not sure if you have resolved it? Thanks.

DrewdropLife commented 3 years ago

Hi, I use torch=1.6. I use "pip install git+https://github.com/thomasbrandon/mish-cuda/" to install mish-cuda. But it give me an error like: ERROR: Command errored out with exit status 1: command: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y5wm_mdb and ERROR: Failed building wheel for mish-cuda and ERROR: Command errored out with exit status 1: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ivpj2a53/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ducnm/.local/include/python3.6m/mish-cuda Check the logs for full command output. How can I solve them? Thanks !

I got the same problem. Not sure if you have resolved it? Thanks.

Instead of installing it, I just defined a class that implements mish by pytorch.

wuy66 commented 3 years ago

Hi, I use torch=1.6. I use "pip install git+https://github.com/thomasbrandon/mish-cuda/" to install mish-cuda. But it give me an error like: ERROR: Command errored out with exit status 1: command: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y5wm_mdb and ERROR: Failed building wheel for mish-cuda and ERROR: Command errored out with exit status 1: /opt/anaconda3/envs/global/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"'; file='"'"'/tmp/pip-req-build-r_3sl_6g/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ivpj2a53/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ducnm/.local/include/python3.6m/mish-cuda Check the logs for full command output. How can I solve them? Thanks !

I got the same problem. Not sure if you have resolved it? Thanks.

Instead of installing it, I just defined a class that implements mish by pytorch.

Thank you. I figured the same thing lol