hzi-bifo / RiboDetector

Accurate and rapid RiboRNA sequences Detector based on deep learning
GNU General Public License v3.0
94 stars 16 forks source link

GPU with higher CUDA version can not be used within old pytorch #8

Closed sixvable closed 2 years ago

sixvable commented 2 years ago

Hi! Thanks for this wonderful tools! 👍 However we use RTX3090 which was coupled with a newer CUDA version 11.4 so it cant be used with pytorch 1.7.1. Could you fix this problem? That would be really helpful.

sixvable

dawnmy commented 2 years ago

Hi sixvable,

Thank you for reporting this issue. I will update the package in pip to support newer version of PyTorch and CUDA. Will let you know when it is updated.

Best Zhi-Luo

dawnmy commented 2 years ago

@sixvable Are you able to install a newer version of pytorch in the environment with pip?

sixvable commented 2 years ago

@sixvable Are you able to install a newer version of pytorch in the environment with pip?

Nope.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ribodetector 0.2.3 requires torch==1.7.1, but you have torch 1.8.1 which is incompatible.
dawnmy commented 2 years ago

I updated the dependency versions in the repo but have't update it in pip. Could you install it with:

conda create -n ribodetector_0.2.4 python=3.8
conda activate ribodetector_0.2.4
git clone https://github.com/hzi-bifo/RiboDetector.git
cd RiboDetector
python setup.py install

And then test if it works for you.

sixvable commented 2 years ago
Traceback (most recent call last):
  File "/share/home/limu/.conda/envs/ribodetector/bin/ribodetector", line 33, in <module>
    sys.exit(load_entry_point('ribodetector==0.2.4', 'console_scripts', 'ribodetector')())
  File "/share/home/limu/.conda/envs/ribodetector/lib/python3.8/site-packages/ribodetector-0.2.4-py3.8.egg/ribodetector/detect.py", line 754, in main
  File "/share/home/limu/.conda/envs/ribodetector/lib/python3.8/site-packages/ribodetector-0.2.4-py3.8.egg/ribodetector/parse_config.py", line 38, in from_json
  File "/share/home/limu/.conda/envs/ribodetector/lib/python3.8/site-packages/ribodetector-0.2.4-py3.8.egg/ribodetector/utils/util.py", line 15, in read_json
  File "/share/home/limu/.conda/envs/ribodetector/lib/python3.8/pathlib.py", line 1200, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/share/home/limu/.conda/envs/ribodetector/lib/python3.8/pathlib.py", line 1054, in _opener
    return self._accessor.open(self, flags, mode)
NotADirectoryError: [Errno 20] Not a directory: '/share/home/limu/.conda/envs/ribodetector/lib/python3.8/site-packages/ribodetector-0.2.4-py3.8.egg/ribodetector/config.json'

Not work 😕 . Am I wrong with some options?

ribodetector -t 20 -m 24 -d 3 -i rawdata/read_1.fq.gz rawdata/read_2.fq.gz -o reads.nonrrna.{1,2}.fq.gz -e norrna -l 150
dawnmy commented 2 years ago

I just did a test, python setup.py install could not install RiboDetector into a right path, pip install . works. Could you install it with

pip install .

instead? The command line you used to run ribodetector is correct.

sixvable commented 2 years ago

Test with CUDA 11.1 and Pytorch 1.8.2, works fine! Really thanks!

sixvable commented 2 years ago

Test with CUDA 11.1 and Pytorch 1.8.2, works fine! Really thanks!

But seems like it does not work with pytorch 1.10.2

dawnmy commented 2 years ago

Could you post the error message when using pytorch 1.10.2. I was able to run it with pytorch 1.10.2. The Python is v3.8.12 and CUDA v10.2. Below are the package versions of the env:

Package           Version
----------------- --------
biopython         1.79
flatbuffers       2.0
numpy             1.22.2
onnxruntime       1.10.0
pandas            1.4.1
pip               22.0.3
protobuf          4.0.0rc2
python-dateutil   2.8.2
pytz              2021.3
ribodetector      0.2.4
setuptools        60.9.3
six               1.16.0
torch             1.10.2
tqdm              4.63.0
typing_extensions 4.1.1
wheel             0.37.1
sixvable commented 2 years ago

It just said that the RTX3090 is not compatible with pytorch 1.10.2. I guess it is because of the CUDA version, not ribodetector itself.

dawnmy commented 2 years ago

Thank you for the clarification. I think the new version PyTorch (v1.10.2) supports only CUDA v10.2 and v11.3 (https://pytorch.org/get-started/locally/). Since you have a different version of CUDA installed. They will be incompatible.

You can install PyTorch v1.10.2 together with CUDA v11.3 as following:

pip3 install torch==1.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

You will have RiboDetector working with PyTorch v1.10.2

dawnmy commented 2 years ago

I think this issue has been solved by installing torch together with the compatible CUDA with:

pip3 install torch==1.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

So I will close this issue.