2022-05-20,CNGB-shenzhen,本地个人电脑,win10专业版,RTX2060
昨天配置了一下 MLBP:https://github.com/xialab-ahu/MLBP
,跑了测试数据成功,其实也遇到一些小BUG,主要有几点:
bio==0.1.0
问题,提示没有0.1.0版本,使用 pip install Bio
命令安装1.3.8版本也能用,今天做一个记录,配置并运行 MLTP:https://github.com/xialab-ahu/MLTP
首先下载 MLTP 项目,双击 predictor.py 用 PyCharm 以 project 打开,并查看 requirements.txt。
报错:
pycharm 改回默认源:https://pypi.python.org/simple
,依然不行。
You will need to adjust your conda configuration to proceed.
Use 'conda config —show channels’ to view your configuration's current state,and use 'conda config --show-sources'to view config file locations.
哈哈,其实应该使用以下语句恢复(conda)到默认源:
conda config --remove-key channels
requirements.txt 中 tensorflow-gpu==1.12.0
,我已经安装了 CUDA9.0 :
cuda_9.0.176_win10
+ cudnn-9.0-windows10-x64-v7.6.5.32
先智能安装:
下方显示进度:(比较慢,得等)
网速太慢了,尝试换自己的网:
因为依赖项(包)太多(102项),所以比昨天时间更长 ☹ 一直是0~几k/s。
…
吃饭ing
…
激活虚拟环境
conda activate MLTP
安装 bio
pip install Bio
将 bio==0.1.0 注释掉,然后 pip install -r requirements.txt
安装剩余依赖项(包)
其实这里走了弯路,可以先安装 bio,将 bio==0.1.0 注释掉,然后
pip install -r requirements.txt
安装剩余依赖项(包),因为智能安装不是很智能
报错:
ERROR: Could not find a version that satisfies the requirement TBB==0.1 (from versions: 2018.0.4, 2019.0, 2020.3.254,
2021.1.1, 2021.2.0, 2021.3.0, 2021.4.0, 2021.5.0, 2021.5.1, 2021.5.2, 2021.6.0)
ERROR: No matching distribution found for TBB==0.1
先试一试:pip install TBB
, 将TBB==0.1
注释掉
(MLTP) D:\BGI\05.ARG\MLTP-main>pip install TBB
Collecting TBB
Downloading tbb-2021.6.0-py3-none-win_amd64.whl (278 kB)
|████████████████████████████████| 278 kB 656 kB/s
Installing collected packages: TBB
Successfully installed TBB-2021.6.0
继续 pip install -r requirements.txt
安装剩余依赖项(包)
有意思的是:
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter
constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so.
To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking
没事更新一下 pip
python -m pip install --upgrade pip
继续安装,报错:
ERROR: Cannot install -r requirements.txt (line 41) and Keras==2.2.4 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested Keras==2.2.4
keras-bert 0.86.0 depends on Keras>=2.4.3
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
(MLTP) D:\BGI\05.ARG\MLTP-main>
难搞吽,因为 TensorFlow 1.12.0 + Keras 2.2.4 on Python 3.6 ,不好改。keras-bert 不乐意了。
选择 2. pip install keras-bert
,删除包版本以允许pip尝试解决依赖关系冲突
Collecting keras-bert
Downloading keras-bert-0.89.0.tar.gz (25 kB)
继续安装:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behav
iour is the source of the following dependency conflicts.
keras-bert 0.89.0 requires keras-transformer==0.40.0, but you have keras-transformer 0.38.0 which is incompatible.
keras-bert 0.89.0需要keras-transformer==0.40.0,但是您的keras-transformer 0.38.0不兼容。
重装试试:
1. pip uninstall keras-transformer
2. pip install keras-transformer
结果爆炸:keras- 一系列版本不兼容
网上搜索,发现 keras_bert == 0.83.0,Keras == 2.2.4
卸载重装:
pip uninstall keras_bert
pip uninstall keras-transformer
pip install keras_bert==0.83.0
保持 keras-transformer==0.38.0
结果:
Successfully installed keras-embed-sim-0.8.0 keras-layer-normalization-0.14.0 keras-multi-head-0.27.0
keras-pos-embd-0.11.0 keras-position-wise-feed-forward-0.6.0 keras-self-attention-0.46.0 keras-transformer-0.38.0
报错:
(MLTP) D:\BGI\05.ARG\MLTP-main>python predictor.py --file test.fasta --out_path result
Traceback (most recent call last):
File "predictor.py", line 9, in <module>
from model import MultiHeadAttention
ModuleNotFoundError: No module named 'model'
ModuleNotFoundError 在 MLTP文件夹下 model.py 中
import sys
sys.path.append("./MLTP")
测试tensorflow:
(MLTP) D:\BGI\05.ARG\MLTP-main>python Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow D:\RJcst\Anaconda3\envs\MLTP\lib\site-packages\scipy\__init__.py:147: UserWarning: NumPy 1.14.5 or above is required for this version of SciPy (detected version 1.14.3) UserWarning)
>>>
NumPy版本问题
参考:https://blog.csdn.net/mao_hui_fei/article/details/89318038
解决方案:先卸载numpy,再卸载numpy,直到卸载到提示信息显示,此时完全已经没有numpy了为止
然后下载numpy
pip install numpy==1.18.3
继续:
(MLTP) D:\BGI\05.ARG\MLTP-main>python predictor.py --file test.fasta --out_path result
Using TensorFlow backend.
D:\RJcst\Anaconda3\envs\MLTP\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (typ
2022-05-20 15:59:16.437896: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: NVIDIA GeForce RTX 2060 major: 7 minor: 5 memoryClockRate(GHz): 1.755
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 5.02GiB
2022-05-20 15:59:16.438121: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2022-05-20 15:59:17.199671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecuto
r with strength 1 edge matrix:
2022-05-20 15:59:17.199840: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2022-05-20 15:59:17.199929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2022-05-20 15:59:17.200305: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:
localhost/replica:0/task:0/device:GPU:0 with 4757 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 206
0, pci bus id: 0000:01:00.0, compute capability: 7.5)
(MLTP) D:\BGI\05.ARG\MLTP-main>
运行成功,生成结果:result/result.txt
>sequence1
functions:ACP
>sequence2
functions:ACP
>sequence3
functions:ACP,AVP
>sequence4
functions:ABP,ACP
>sequence5
functions:ACP
完美!
tensorflow_gpu-1.12.0
Python3.6
CUDA9.0
cuDNN7+