KennthShang / PhaBOX

Local version of the virus identification and analysis web server (tool set)
https://phage.ee.cityu.edu.hk/
Academic Free License v3.0
37 stars 5 forks source link

Cannot find pre-trained model #6

Closed XC-Zhai closed 1 year ago

XC-Zhai commented 1 year ago

Thanks for this tool. But there is a error when I try the test fasta file on Linux system with conda. (phabox) ~/PhaBOX$ python main.py --contigs test_contigs.fa --threads 8 --len 3000 --rootpth simple_test --out out/ --dbdir database/ --parampth parameters/ Using parallelized prodigal... Running prodigal... Running Diamond... cannot find pre-trained model

Thanks for your help.

KennthShang commented 1 year ago

Please make sure you have followed the guidelines and downloaded the files from Google drive.

# database
fileid="1hjACPsIOqqcS5emGaduYvYrCzrIpt2_9"
filename="phagesuite_database.zip"
html=`curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}"`
curl -Lb ./cookie "https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\-_]+)'`&id=${fileid}" -o ${filename}

# inital files
fileid="1E94ii3Q0O8ZBm7UsyDT_n06YekNtfV20"
filename="phagesuite_parameters.zip"
html=`curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}"`
curl -Lb ./cookie "https://drive.google.com/uc?export=download&`echo ${html}|grep -Po '(confirm=[a-zA-Z0-9\-_]+)'`&id=${fileid}" -o ${filename}

If you are in mainland China, make sure you can access the files. Otherwise, a VPN is needed.

Best, Jiayu

XC-Zhai commented 1 year ago

I am using this in Europe, both database and parameters files were downloaded and unzipped under PhaBox. And transformer.pth is under the parameters file. I am not sure why I got this error "cannot find pre-trained model".

Best, Xichuan

KennthShang commented 1 year ago

Please show your screenshot and check whether the downloaded files are the same as below.

image

Best, Jiayu

XC-Zhai commented 1 year ago

Thanks a lot. Here is the file lists under parameters folder:

20230403083357

Best, Xichuan

KennthShang commented 1 year ago

Please try the following commands under the PhaBOX folder:

first:

python

Then

import torch

device = torch.device("cuda" if torch.cuda.is_available() else "CPU")

try:
    pretrained_dict=torch.load(f'parameters/transformer.pth', map_location=device)
except:
    print('cannot find pre-trained model')
    exit(1)
XC-Zhai commented 1 year ago

Thanks a lot. It seemed that the default installing will use cuda instead of cup. All of them could be run successfully after: conda install pytorch torchvision torchaudio cpuonly -c pytorch (1.0-cuda --> 1.0-cpu).

I will explore my real virome dataset with this. Have a nice day.

Best, Xichuan

KennthShang commented 1 year ago

Good to know.

Best, Jiayu