rmeli / gnina-torch Goto Github PK
View Code? Open in Web Editor NEW๐ฅ PyTorch implementation of GNINA scoring function for molecular docking
Home Page: https://gnina-torch.rtfd.io
License: MIT License
๐ฅ PyTorch implementation of GNINA scoring function for molecular docking
Home Page: https://gnina-torch.rtfd.io
License: MIT License
Allow the use ofmolgrid.FileMappedGninaTyper
and provide the following input parameters for consistency with published models:
--ligmap
--recmap
PR #10 asserts that "the learning rate update is based on the loss function of the test set (instead of the training set)". This was the intent (although it should probably monitor the loss function of the training set for consistency), but by attaching the LR scheduler update to the evaluator
Lines 652 to 656 in f8aecb6
effectively causes the LR scheduler to be called twice, since the same evaluator is used to evaluate the training set and the test set.
Lines 630 to 632 in f8aecb6
Lines 677 to 679 in f8aecb6
Possible solutions suggested by @vfdev-5:
I'm getting a strange error: *** Error in 'python': free(): invalid pointer: 0x00002aaaffba8c40 ***
when trying to run GNINA from a separate file:
I have a file gnina_feat.py
with the following code:
import torch
from argparse import Namespace
import tempfile
from tqdm.autonotebook import tqdm
from gninatorch import setup, gnina, dataloaders
class VoxelLoader(dataloaders.GriddedExamplesLoader):
def __len__(self):
return self.num_batches
grid_args = Namespace(**{'data_root':'',
'batch_size':20,
'ligmolcache':"",
'recmolcache':"",
'cache_structures':False,
'dimension':23.5,
'resolution':0.5,
'balanced':False,
'shuffle':False,
'stratify_receptor':False,
'stratify_pos':False,
'iteration_scheme':'small',
'stratify_max':0,
'stratify_min':0,
'stratify_step':0})
def get_gnina_feats_from_df(df, device='cuda'):
temp_name = next(tempfile._get_candidate_names())
types_file = f'/local/tmp/{temp_name}.types'
with open(types_file, "w") as text_file:
for i, (_, row) in enumerate(df.iterrows()):
file_str = f"{i} {row['docked_pocket_path']} {row['docked_ligand_path']}"
print(file_str, file=text_file)
provider = setup.setup_example_provider(
types_file, grid_args, training=False
)
grid_maker = setup.setup_grid_maker(grid_args)
all_loader = VoxelLoader(
example_provider=provider,
grid_maker=grid_maker,
random_translation=0,
random_rotation=False,
device=device,
)
model = gnina.setup_gnina_model('dense_ensemble')[0]
model.to(torch.device(device))
feats = list()
with torch.inference_mode():
for batch in tqdm(all_loader, desc='Predicting GNINA features'):
feat = list()
for mod in model.models:
feat.append(mod.features(batch[0]).squeeze()[None])
feats.append(torch.cat(feat).mean(0))
feats = torch.cat(feats).cpu()
return [f for f in feats]
Then in a separate file I call:
feats = get_gnina_feats_from_df(df)
Which yields the error:
*** Error in `python': free(): invalid pointer: 0x00002aaaffba8c40 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x2aaaab675329]
/home/kirillshmilovich/.local/lib/python3.10/site-packages/molgrid/molgrid.so(_ZNSt23_Sp_counted_ptr_inplaceIN10libmolgrid15ExampleProviderESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv+0x539)[0x2aab88d32c09]
/home/kirillshmilovich/.local/lib/python3.10/site-packages/molgrid/molgrid.so(_ZN5boost6python7objects14pointer_holderISt10shared_ptrIN10libmolgrid15ExampleProviderEES5_ED1Ev+0x5a)[0x2aab88d00bba]
/home/kirillshmilovich/.local/lib/python3.10/site-packages/molgrid/molgrid.so(+0x6d8c9f)[0x2aab88f00c9f]
python[0x50ec0e]
python[0x4ec2c6]
python[0x50eadc]
python[0x4f8478]
python(_PyFunction_Vectorcall+0xa5)[0x4ff2a5]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x731)[0x4efd81]
python[0x50a69e]
python(PyObject_Call+0xb8)[0x50b048]
python(_PyEval_EvalFrameDefault+0x2a50)[0x4f20a0]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x4b2c)[0x4f417c]
python[0x50a69e]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python[0x50a7f6]
python(_PyEval_EvalFrameDefault+0x2a50)[0x4f20a0]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x4b2c)[0x4f417c]
python[0x50a69e]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python[0x50a69e]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x13b2)[0x4f0a02]
python(_PyFunction_Vectorcall+0x6f)[0x4ff26f]
python(_PyEval_EvalFrameDefault+0x31f)[0x4ef96f]
python[0x594fd2]
python(PyEval_EvalCode+0x87)[0x594f17]
python[0x5c7667]
python[0x5c24c0]
python[0x45ba37]
python(_PyRun_SimpleFileObject+0x19f)[0x5bc9df]
python(_PyRun_AnyFileObject+0x43)[0x5bc7e3]
python(Py_RunMain+0x38d)[0x5b95fd]
python(Py_BytesMain+0x39)[0x588099]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x2aaaab616555]
python[0x587f4e]
======= Memory map: ========
00400000-0041f000 r--p 00000000 00:3d 563664911 /home/kirillshmilovich/.conda/envs/binding_affinity/bin/python3.10
0041f000-0061f000 r-xp 0001f000 00:3d 563664911 /home/kirillshmilovich/.conda/envs/binding_affinity/bin/python3.10
0061f000-00721000 r--p 0021f000 00:3d 563664911 /home/kirillshmilovich/.conda/envs/binding_affinity/bin/python3.10
00722000-00723000 r--p 00321000 00:3d 563664911 /home/kirillshmilovich/.conda/envs/binding_affinity/bin/python3.10
00723000-00755000 rw-p 00322000 00:3d 563664911 /home/kirillshmilovich/.conda/envs/binding_affinity/bin/python3.10
00755000-1dff1000 rw-p 00000000 00:00 0 [heap]
200000000-200200000 ---p 00000000 00:00 0
200200000-200400000 rw-s 00000000 00:05 48522 /dev/nvidiactl
200400000-202400000 rw-s 00000000 00:05 48522 /dev/nvidiactl
202400000-205400000 rw-s 00000000 00:05 48522 /dev/nvidiactl
205400000-206000000 ---p 00000000 00:00 0
206000000-206200000 rw-s 00000000 00:05 48522 /dev/nvidiactl
206200000-206400000 rw-s 00000000 00:05 48522 /dev/nvidiactl
206400000-206600000 rw-s 206400000 00:05 53296 /dev/nvidia-uvm
206600000-206800000 rw-s 00000000 00:05 48522 /dev/nvidiactl
206800000-206a00000 ---p 00000000 00:00 0
206a00000-206c00000 rw-s 00000000 00:05 48522 /dev/nvidiactl
206c00000-300200000 ---p 00000000 00:00 0
10000000000-10104000000 ---p 00000000 00:00 0
3c52e000000-3c56e000000 rw-p 00000000 00:00 0
2aaaaaaab000-2aaaaaacd000 r-xp 00000000 09:00 203039084 /usr/lib64/ld-2.17.so
2aaaaaacd000-2aaaaaacf000 r-xp 00000000 00:00 0 [vdso]
2aaaaaacf000-2aaaaaad0000 rw-p 00000000 00:00 0
2aaaaaad0000-2aaaaaad7000 r--s 00000000 09:00 140121628 /usr/lib64/gconv/gconv-modules.cache
2aaaaaad7000-2aaaaaadc000 r--p 00000000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaadc000-2aaaaaae5000 r-xp 00005000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaae5000-2aaaaaaed000 r--p 0000e000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaaed000-2aaaaaaee000 ---p 00016000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaaee000-2aaaaaaef000 r--p 00016000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaaef000-2aaaaaaf0000 rw-p 00017000 00:3d 481877408 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu.so
2aaaaaaf0000-2aaaaaaf1000 r--p 00000000 00:3d 481877383 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_heapq.cpython-310-x86_64-linux-gnu.so
2aaaaaaf1000-2aaaaaaf4000 r-xp 00001000 00:3d 481877383 /home/kirillshmilovich/.conda/envs/binding_affinity/lib/python3.10/lib-dynload/_heapq.cpython-310-x86_64-linux-gnu.soAborted
Strangely, if I place a debug statement within the get_gnina_feats_from_df
function, e.g. at the end of the original file,
with torch.inference_mode():
for batch in tqdm(all_loader, desc='Predicting GNINA features'):
feat = list()
for mod in model.models:
feat.append(mod.features(batch[0]).squeeze()[None])
feats.append(torch.cat(feat).mean(0))
feats = torch.cat(feats).cpu()
import ipdb; ipdb.set_trace()
return [f for f in feats]
and then continue after entering that debug statement (i.e., pressing c
after entering the debugger) everything appears to run fine without error. Although the error appears again once I Cntl-C
out of the debugger.
Do you have any idea what the origin of this error might be and how I might be able to fix it and get this to work without using the debugger?
Hi, I want to know if there is an easy way to use model trained by gnina-torch to transfer into Caffe-model-weight file,
or directly use your gnina-torch model to dock (I didn't find it's possible according to your README)?
The function
Lines 9 to 33 in f8aecb6
This might be confusing at times. For example, when there is no binding affinity annotation the following is printed to the log file:
[...]
affinity_pos = None
[...]
pseudo_huber_affinity_loss = False
delta_affinity_loss: 4.00000E+00
scale_affinity_loss: 1.00000E+00
penalty_affinity_loss: 1.00000E+00
[...]
Only the variables that are relevant for the run should be printed out. In this case affinity_pos = None
should be printed (to indicate that there is no binding affinity annotation), but everything else is superfluous and confusing.
The same happens for dynamic learning rate:
[...]
lr_dynamic = False
lr_patience = 5
lr_reduce: 1.00000E-01
lr_min: 1.00000E-05
[...]
lr_dynamic = False
should be printed, everything else is superfluous and confusing.
$ pytest --cov==gninatorch
Segmentation fault (core dumped)
CentOS7 Linux server
Anaconda environment (python3.9)
I have created this environment and install all the libraries manually.
(It takes hours in the 'solving' process when running conda env create -f devtools/conda-envs/gninatorch.yaml
, so I quit and created a environment 'gninatorch' and install libraries one by one as the yml shows)
After all dependencies have been installed (I additionally installed scikit-learn-intelex
as the scikit-learn
suggests), I run python -m pip install .
the gninatorch 0.0.2+3.ge46cb51
successfully installed. BUT It could not success at $ pytest --cov==gninatorch
.
-------------conda list---------------
_libgcc_mutex 0.1 main anaconda
_openmp_mutex 5.1 1_gnu anaconda
abseil-cpp 20211102.0 h27087fc_1 conda-forge
alembic 1.8.1 pyhd8ed1ab_0 conda-forge
appdirs 1.4.4 pyhd3eb1b0_0 anaconda
arrow-cpp 8.0.0 py39h60b952e_0 anaconda
asttokens 2.0.5 pyhd3eb1b0_0 anaconda
attrs 22.1.0 py39h06a4308_0 anaconda
aws-c-common 0.4.57 he6710b0_1 anaconda
aws-c-event-stream 0.1.6 h2531618_5 anaconda
aws-checksums 0.1.9 he6710b0_0 anaconda
aws-sdk-cpp 1.8.185 hce553d0_0 anaconda
backcall 0.2.0 pyhd3eb1b0_0 anaconda
bcrypt 3.2.2 py39hb9d737c_0 conda-forge
black 22.6.0 py39h06a4308_0 anaconda
blas 1.0 mkl anaconda
blinker 1.6.2 pyhd8ed1ab_0 conda-forge
boost-cpp 1.78.0 he72f1d9_0 conda-forge
bottleneck 1.3.5 py39h7deecbd_0 anaconda
brotli 1.0.9 h166bdaf_7 conda-forge
brotli-bin 1.0.9 h166bdaf_7 conda-forge
brotlipy 0.7.0 py39h27cfd23_1003 anaconda
bzip2 1.0.8 h7f98852_4 conda-forge
c-ares 1.18.1 h7f8727e_0 anaconda
ca-certificates 2023.01.10 h06a4308_0 anaconda
certifi 2022.12.7 py39h06a4308_0 anaconda
cffi 1.15.1 py39h5eee18b_3 anaconda
cfgv 3.3.1 py39h06a4308_0 anaconda
charset-normalizer 2.0.4 pyhd3eb1b0_0 anaconda
click 8.1.6 unix_pyh707e725_0 conda-forge
cloudpickle 2.2.1 pyhd8ed1ab_0 conda-forge
codecov 2.1.11 pyhd3eb1b0_0 anaconda
configparser 5.3.0 pyhd8ed1ab_0 conda-forge
coverage 6.3.2 py39h7f8727e_0 anaconda
cryptography 38.0.4 py39h9ce1e76_0 anaconda
cudatoolkit 11.3.1 h2bc3f7f_2 anaconda
cycler 0.11.0 pyhd8ed1ab_0 conda-forge
daal4py 2023.1.1 py39h79cecc1_0 defaults
dal 2023.1.1 hdb19cb5_48679 defaults
databricks-cli 0.17.7 pyhd8ed1ab_1 conda-forge
decorator 5.1.1 pyhd3eb1b0_0 anaconda
distlib 0.3.6 py39h06a4308_0 anaconda
docker-py 6.1.3 pyhd8ed1ab_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_0 conda-forge
exceptiongroup 1.1.2 pypi_0 pypi
executing 0.8.3 pyhd3eb1b0_0 anaconda
fftw 3.3.9 h27cfd23_1 anaconda
filelock 3.9.0 py39h06a4308_0 anaconda
flake8 6.0.0 py39h06a4308_0 anaconda
flask 2.3.2 pyhd8ed1ab_0 conda-forge
flit-core 3.6.0 pyhd3eb1b0_0 anaconda
freetype 2.12.1 h4a9f257_0 anaconda
gflags 2.2.2 he1b5a44_1004 conda-forge
giflib 5.2.1 h5eee18b_1 anaconda
gitdb 4.0.10 pyhd8ed1ab_0 conda-forge
gitpython 3.1.32 pyhd8ed1ab_0 conda-forge
glog 0.6.0 h6f12383_0 conda-forge
gninatorch 0.0.2+3.ge46cb51 pypi_0 pypi
greenlet 2.0.1 py39h6a678d5_0 anaconda
grpc-cpp 1.46.1 h33aed49_1 anaconda
gunicorn 20.1.0 py39hf3d152e_3 conda-forge
icu 70.1 h27087fc_0 conda-forge
identify 2.5.5 py39h06a4308_0 anaconda
idna 3.4 py39h06a4308_0 anaconda
ignite 0.4.12 py_0 pytorch
importlib-metadata 6.8.0 pyha770c72_0 conda-forge
importlib_resources 6.0.0 pyhd8ed1ab_1 conda-forge
iniconfig 2.0.0 pypi_0 pypi
intel-openmp 2021.4.0 h06a4308_3561 anaconda
ipython 8.8.0 py39h06a4308_0 anaconda
isort 5.9.3 pyhd3eb1b0_0 anaconda
itsdangerous 2.1.2 pyhd8ed1ab_0 conda-forge
jedi 0.18.1 py39h06a4308_1 anaconda
jinja2 3.1.2 pyhd8ed1ab_1 conda-forge
joblib 1.3.0 pyhd8ed1ab_1 conda-forge
jpeg 9e h7f8727e_0 anaconda
keyutils 1.6.1 h166bdaf_0 conda-forge
kiwisolver 1.4.4 py39h6a678d5_0 anaconda
krb5 1.19.3 h3790be6_0 conda-forge
lcms2 2.12 h3be6417_0 anaconda
ld_impl_linux-64 2.38 h1181459_1 anaconda
lerc 3.0 h295c915_0 anaconda
libbrotlicommon 1.0.9 h166bdaf_7 conda-forge
libbrotlidec 1.0.9 h166bdaf_7 conda-forge
libbrotlienc 1.0.9 h166bdaf_7 conda-forge
libcurl 7.87.0 h91b91d3_0 anaconda
libdeflate 1.8 h7f8727e_5 anaconda
libedit 3.1.20191231 he28a2e2_2 conda-forge
libev 4.33 h516909a_1 conda-forge
libevent 2.1.10 h9b69904_4 conda-forge
libffi 3.4.2 h6a678d5_6 anaconda
libgcc-ng 11.2.0 h1234567_1 anaconda
libgfortran-ng 11.2.0 h00389a5_1 anaconda
libgfortran5 11.2.0 h1234567_1 anaconda
libgomp 11.2.0 h1234567_1 anaconda
libnghttp2 1.46.0 hce63b2e_0 anaconda
libpng 1.6.37 hbc83047_0 anaconda
libprotobuf 3.20.3 he621ea3_0 anaconda
libsodium 1.0.18 h36c2ea0_1 conda-forge
libssh2 1.10.0 h8f2d780_0 anaconda
libstdcxx-ng 11.2.0 h1234567_1 anaconda
libthrift 0.15.0 he6d91bd_0 conda-forge
libtiff 4.5.0 h6a678d5_1 anaconda
libuv 1.40.0 h7b6447c_0 anaconda
libwebp 1.2.4 h11a3e52_0 anaconda
libwebp-base 1.2.4 h5eee18b_0 anaconda
lz4-c 1.9.4 h6a678d5_0 anaconda
mako 1.2.4 pyhd8ed1ab_0 conda-forge
markdown 3.4.3 pyhd8ed1ab_0 conda-forge
markupsafe 2.1.1 py39h7f8727e_0 anaconda
matplotlib-base 3.4.3 py39h2fa2bec_2 conda-forge
matplotlib-inline 0.1.6 py39h06a4308_0 anaconda
mccabe 0.7.0 pyhd3eb1b0_0 anaconda
mkl 2021.4.0 h06a4308_640 anaconda
mkl-service 2.4.0 py39h7f8727e_0 anaconda
mkl_fft 1.3.1 py39hd3c417c_0 anaconda
mkl_random 1.2.2 py39h51133e4_0 anaconda
mlflow 2.5.0 py39ha39b057_0 conda-forge
molgrid 0.5.3 pypi_0 pypi
mpi 1.0 mpich anaconda
mpich 4.1.1 hbae89fd_0 defaults
mypy 0.981 py39h06a4308_0 anaconda
mypy_extensions 0.4.3 py39h06a4308_1 anaconda
ncurses 6.4 h6a678d5_0 anaconda
nodeenv 1.7.0 py39h06a4308_0 anaconda
numexpr 2.8.4 py39he184ba9_0 anaconda
numpy 1.23.5 py39h14f4228_0 anaconda
numpy-base 1.23.5 py39h31eccc5_0 anaconda
oauthlib 3.2.2 pyhd8ed1ab_0 conda-forge
openssl 1.1.1s h7f8727e_0 anaconda
orc 1.7.4 h07ed6aa_0 anaconda
packaging 22.0 py39h06a4308_0 anaconda
pandas 1.5.2 py39h417a72b_0 anaconda
paramiko 3.2.0 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd3eb1b0_0 anaconda
pathspec 0.10.3 py39h06a4308_0 anaconda
pexpect 4.8.0 pyhd3eb1b0_3 anaconda
pickleshare 0.7.5 pyhd3eb1b0_1003 anaconda
pillow 9.3.0 py39h6a678d5_2 anaconda
pip 22.3.1 py39h06a4308_0 anaconda
platformdirs 2.5.2 py39h06a4308_0 anaconda
pluggy 1.2.0 pypi_0 pypi
pooch 1.4.0 pyhd3eb1b0_0 anaconda
pre-commit 2.20.0 py39h06a4308_0 anaconda
prometheus_client 0.17.1 pyhd8ed1ab_0 conda-forge
prometheus_flask_exporter 0.22.4 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.36 py39h06a4308_0 anaconda
protobuf 3.20.3 py39h6a678d5_0 anaconda
psutil 5.9.0 py39h5eee18b_0 anaconda
ptyprocess 0.7.0 pyhd3eb1b0_2 anaconda
pure_eval 0.2.2 pyhd3eb1b0_0 anaconda
py 1.11.0 pyhd3eb1b0_0 anaconda
pyarrow 8.0.0 py39h992f0b0_0 anaconda
pycodestyle 2.10.0 py39h06a4308_0 anaconda
pycparser 2.21 pyhd3eb1b0_0 anaconda
pyflakes 3.0.1 py39h06a4308_0 anaconda
pygments 2.11.2 pyhd3eb1b0_0 anaconda
pyjwt 2.8.0 pyhd8ed1ab_0 conda-forge
pynacl 1.5.0 py39hb9d737c_1 conda-forge
pyopenssl 22.0.0 pyhd3eb1b0_0 anaconda
pyparsing 3.1.0 pyhd8ed1ab_0 conda-forge
pyquaternion 0.9.9 pypi_0 pypi
pysocks 1.7.1 py39h06a4308_0 anaconda
pytest 7.4.0 pypi_0 pypi
pytest-cov 3.0.0 pyhd3eb1b0_0 anaconda
python 3.9.16 h7a1cb2a_0 anaconda
python-dateutil 2.8.2 pyhd3eb1b0_0 anaconda
python_abi 3.9 2_cp39 conda-forge
pytorch 1.11.0 py3.9_cuda11.3_cudnn8.2.0_0 pytorch
pytorch-mutex 1.0 cuda pytorch
pytz 2022.7 py39h06a4308_0 anaconda
pywin32-on-windows 0.1.0 pyh1179c8e_3 conda-forge
pyyaml 6.0 py39hb9d737c_4 conda-forge
querystring_parser 1.2.4 py_0 conda-forge
re2 2022.04.01 h27087fc_0 conda-forge
readline 8.2 h5eee18b_0 anaconda
requests 2.28.1 py39h06a4308_0 anaconda
scikit-learn 1.2.0 py39h6a678d5_0 anaconda
scikit-learn-intelex 2023.1.1 py39h06a4308_0 defaults
scipy 1.10.0 py39h14f4228_0 anaconda
setuptools 65.6.3 py39h06a4308_0 anaconda
six 1.16.0 pyhd3eb1b0_1 anaconda
smmap 3.0.5 pyh44b312d_0 conda-forge
snappy 1.1.9 h295c915_0 anaconda
sqlalchemy 1.4.39 py39h5eee18b_0 anaconda
sqlite 3.40.1 h5082296_0 anaconda
sqlparse 0.4.4 pyhd8ed1ab_0 conda-forge
stack_data 0.2.0 pyhd3eb1b0_0 anaconda
tabulate 0.9.0 pyhd8ed1ab_1 conda-forge
tbb 2021.6.0 hdb19cb5_1 anaconda
threadpoolctl 3.2.0 pyha21a80b_0 conda-forge
tk 8.6.12 h1ccaba5_0 anaconda
toml 0.10.2 pyhd3eb1b0_0 anaconda
tomli 2.0.1 py39h06a4308_0 anaconda
torchvision 0.13.1 cpu_py39h164cc8f_0 anaconda
tornado 6.1 py39hb9d737c_3 conda-forge
tqdm 4.64.1 py39h06a4308_0 anaconda
traitlets 5.7.1 py39h06a4308_0 anaconda
typing_extensions 4.4.0 py39h06a4308_0 anaconda
tzdata 2022a hda174b7_0 anaconda
ukkonen 1.0.1 py39hdb19cb5_0 anaconda
urllib3 1.26.14 py39h06a4308_0 anaconda
utf8proc 2.6.1 h27cfd23_0 anaconda
virtualenv 20.17.1 py39h06a4308_0 anaconda
wcwidth 0.2.5 pyhd3eb1b0_0 anaconda
websocket-client 1.6.1 pyhd8ed1ab_0 conda-forge
werkzeug 2.3.6 pyhd8ed1ab_0 conda-forge
wheel 0.37.1 pyhd3eb1b0_0 anaconda
xz 5.2.10 h5eee18b_1 anaconda
yaml 0.2.5 h7f98852_2 conda-forge
zipp 3.16.2 pyhd8ed1ab_0 conda-forge
zlib 1.2.13 h5eee18b_0 anaconda
zstd 1.5.2 ha4553b6_0 anaconda
The models_dict
variable has changed considerably:
Lines 1069 to 1078 in bc780b8
Lines 89 to 97 in bc780b8
gnina-torch/gnina/inference.py
Line 32 in bc780b8
Weights of the pre-trained GNINA models were provided in #34 by @drewnutt , getting a steps closer towards #33 .
The following needs to be implemented in order to have the weights readily available:
default
model #44gninatorch
#37This additional functionality could be implemented in gnina.py
and follow the GNINA command line as closely as possible. In addition to .types
files, it would be good to use molgrid.openbabel
to provide the --receptor
and --ligand
options.
Hi.
I would like to use this repository and I have a question.
When training, what should I write as settings in the types file?
ex. https://github.com/RMeli/gnina-torch/blob/main/tests/data/test.types
I reckon the first column is label information, the fourth and fifth columns are PDB and ligand information, but what are the second and third columns?
Some parameters are not exposed to the user, use default values or are not implemented (compared to the original GNINA implementation in Caffe). This issue tracks all parameters that need to be added and exposed to the user.
molgrid.ExampleProvider
parameters:
--ligmolcache
--recmolcache
--stratify_receptor
molgrid.GridMaker
parameters:
--dimension
--resolution
Loss parameters:
--scale
(affinity loss)--penalty
(affinity loss)Is there any info/tutorials/examples on how I can generate data files from my own structures/docked poses as input compatible for training gnina models. I know libmolgrid
is used for handling the data to enable things random rotations for data augmentation, but I can't seem to find anything on how I can go about featurizing my own structures into the file scheme read by libmolgrid
, (i.e., using the ExampleProvider
). (edited)
I would love to use this module within liGAN instead of depending on the full gnina platform. Have the caffe model weights been converted to pytorch somewhere publicly available?
Add timings for training:
Define weights and biases initialisation function outside of models' __init__
and perform initialisation with nn.Module.apply()
function.
Check how biases are initialised and perform the same initialisation.
The random translation performed by dataloaders.GriddedExamplesLoader
is wrong:
gnina-torch/gninatorch/dataloaders.py
Lines 128 to 133 in 34650b8
Some output files currently have a fixed name:
training.log
inference.log
checkpoint_${iter}.pt
This can be problematic when training different models (for example on different cross-validation folds). Checkpoints can result in the following errors:
FileNotFoundError: [Errno 2] No such file or directory: 'training/flex1/checkpoint_1.pt'
ValueError: Files ['checkpoint_2.pt'] with extension '.pt' are already present in the directory training/flex1/. If you want to use this directory anyway, pass `require_empty=False`.
My conda env is in mamba-forge so the environment 'gninatorch' has python in ~/mambaforge/envs/gninatorch/bin/python
then in directoy: ~/gnina-torch
I run python -m pytest --cov=gninatorch
THE ERROR IS :
--------------------------------------- Captured log call --------------------------------------
ERROR ignite.engine.engine.Engine:engine.py:1086 Current run is terminating due to exception: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
File "/data2/rjli/gnina-torch/gninatorch/models.py", line 320, in forward
x = x.view(-1, self.features_out_size)
lig_pose_raw = self.lig_pose(x)
~~~~~~~~~~~~~ <--- HERE
lig_pose_log = F.log_softmax(lig_pose_raw, dim=1)
File "/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward
def forward(self, input):
for module in self:
input = module(input)
~~~~~~ <--- HERE
return input
File "/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/torch/nn/modules/linear.py", line 103, in forward
def forward(self, input: Tensor) -> Tensor:
return F.linear(input, self.weight, self.bias)
~~~~~~~~ <--- HERE
RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
ERROR ignite.engine.engine.Engine:engine.py:992 Engine run is terminating due to exception: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
File "/data2/rjli/gnina-torch/gninatorch/models.py", line 320, in forward
x = x.view(-1, self.features_out_size)
lig_pose_raw = self.lig_pose(x)
~~~~~~~~~~~~~ <--- HERE
lig_pose_log = F.log_softmax(lig_pose_raw, dim=1)
File "/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward
def forward(self, input):
for module in self:
input = module(input)
~~~~~~ <--- HERE
return input
File "/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/torch/nn/modules/linear.py", line 103, in forward
def forward(self, input: Tensor) -> Tensor:
return F.linear(input, self.weight, self.bias)
~~~~~~~~ <--- HERE
RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
=============================================================================================== warnings summary ================================================================================================
../mambaforge/envs/gninatorch/lib/python3.9/site-packages/mlflow/utils/requirements_utils.py:12
/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/mlflow/utils/requirements_utils.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
../mambaforge/envs/gninatorch/lib/python3.9/site-packages/pkg_resources/__init__.py:2871
/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
../mambaforge/envs/gninatorch/lib/python3.9/site-packages/pkg_resources/__init__.py:2871
/data2/rjli/mambaforge/envs/gninatorch/lib/python3.9/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------- coverage: platform linux, python 3.9.16-final-0 -----------
Name Stmts Miss Cover
-----------------------------------------------
gninatorch/__init__.py 5 0 100%
gninatorch/dataloaders.py 73 1 99%
gninatorch/gnina.py 105 7 93%
gninatorch/inference.py 87 50 43%
gninatorch/losses.py 32 0 100%
gninatorch/metrics.py 28 0 100%
gninatorch/models.py 218 39 82%
gninatorch/setup.py 12 0 100%
gninatorch/training.py 235 67 71%
gninatorch/transforms.py 20 0 100%
gninatorch/utils.py 39 16 59%
-----------------------------------------------
TOTAL 854 180 79%
============================================================================================ short test summary info ============================================================================================
FAILED tests/test_gnina.py::test_gnina_model_prediction[redock_default2018-CNNscore0-CNNaffinity0] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction[general_default2018-CNNscore1-CNNaffinity1] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction[crossdock_default2018-CNNscore2-CNNaffinity2] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction[dense-CNNscore3-CNNaffinity3] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction_ensemble[redock_default2018-CNNscore0-CNNaffinity0-CNNvariance0] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction_ensemble[general_default2018-CNNscore1-CNNaffinity1-CNNvariance1] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction_ensemble[crossdock_default2018-CNNscore2-CNNaffinity2-CNNvariance2] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_model_prediction_ensemble[dense-CNNscore3-CNNaffinity3-CNNvariance3] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina[redock_default2018-CNNscore0-CNNaffinity0] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina[general_default2018-CNNscore1-CNNaffinity1] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina[crossdock_default2018-CNNscore2-CNNaffinity2] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina[dense-CNNscore3-CNNaffinity3] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_ensemble[redock_default2018_ensemble-CNNscore0-CNNaffinity0-CNNvariance0] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_ensemble[general_default2018_ensemble-CNNscore1-CNNaffinity1-CNNvariance1] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_ensemble[crossdock_default2018_ensemble-CNNscore2-CNNaffinity2-CNNvariance2] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_ensemble[dense_ensemble-CNNscore3-CNNaffinity3-CNNvariance3] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_gnina.py::test_gnina_ensemble[default-CNNscore4-CNNaffinity4-CNNvariance4] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_inference.py::test_inference - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_inference.py::test_inference_affinity - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_inference.py::test_inference_flex - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_models.py::test_forward_pose[default2017] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_pose[default2018] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_pose[dense] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity[default2017] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity[default2018] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity[dense] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity[hires_pose] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_flex[default2017] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_flex[default2018] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_flex[dense] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity_big[default2017] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity_big[default2018] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity_big[dense] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity_big[hires_pose] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_forward_affinity_big[hires_affinity] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_gnina_model_ensemble_average[default2017] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_gnina_model_ensemble_average[default2018] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_models.py::test_gnina_model_ensemble_average[dense] - RuntimeError: CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)`
FAILED tests/test_training.py::test_training - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_training.py::test_training_with_test - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_training.py::test_training_pose_and_affinity_with_test - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_training.py::test_training_lr_scheduler_with_test - RuntimeError: The following operation failed in the TorchScript interpreter.
FAILED tests/test_training.py::test_training_flexposepose_with_test - RuntimeError: The following operation failed in the TorchScript interpreter.
============================================================================= 43 failed, 88 passed, 3 warnings in 149.65s (0:02:29)
hi,
Will this script work fully in windows 10?
many thanks
Sh-Y
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.