Skip to content

Commit e25154e

Browse files
committed
feat: add Diffusion Structure Module
1 parent 90461ca commit e25154e

11 files changed

Lines changed: 2813 additions & 10 deletions

File tree

examples/generate.job

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=profold2_generate # identifier for the job listings
3+
#SBATCH --output=generate.log # outputfile
4+
5+
#SBATCH --nodes=2 # number of nodes you want to use
6+
#SBATCH --gpus=4 # count of GPUs required for the job
7+
#SBATCH --qos=gpugpu # quality of service
8+
#SBATCH --ntasks-per-node=1 # number of tasks to invoke on each node
9+
#SBATCH --gpus-per-task=2 # every process wants one GPU!
10+
#SBATCH --gpu-bind=none # NCCL can't deal with task-binding...
11+
12+
# check if script is started via SLURM or bash
13+
# if with SLURM: there variable '$SLURM_JOBID' will exist
14+
CWD=$0
15+
if [ -n "${SLURM_JOBID}" ]; then
16+
CWD=`scontrol show job ${SLURM_JOBID}|awk -F= '/Command=/{print $2}'`
17+
fi
18+
CWD=`realpath -s ${CWD}`
19+
CWD=`dirname ${CWD}`
20+
PWD=`dirname ${CWD}`
21+
22+
help() {
23+
echo "usage: `basename $0` [-h] -p {slurm,local} -- [pred_opt ...] fasta_file [fasta_file ...]"
24+
echo "positional arguments:"
25+
echo " pred_opt generate option."
26+
echo " \`python ${PWD}/main.py generate -h\` for further help."
27+
echo " fasta_file fasta format protein sequence file."
28+
echo "options:"
29+
echo " -h, --help show this help message and exit"
30+
echo " -p PLATFORM, --platform PLATFORM {slurm,local}"
31+
echo " type of platform. (default: slurm)"
32+
exit $1
33+
}
34+
35+
platform="slurm"
36+
37+
ARGS=$(getopt -o "p:h" -l "platform:,help" -- "$@") || help 1
38+
eval "set -- ${ARGS}"
39+
while true; do
40+
case "$1" in
41+
(-p | --platform) platform="$2"; shift 2;;
42+
(-h | --help) help 0 ;;
43+
(--) shift 1; break;;
44+
(*) help 1;
45+
esac
46+
done
47+
48+
## get the first node name as master address - customized for vgg slurm
49+
## e.g. master(gnodee[2-5],gnoded1) == gnodee2
50+
echo "==================================="
51+
echo "CurrentWorkDir=`pwd`"
52+
echo "Platform=${platform}"
53+
if [ x"${platform}" = x"slurm" ]; then
54+
echo "NodeList=${SLURM_NODELIST}"
55+
master_addr=$(scontrol show hostnames "${SLURM_JOB_NODELIST}" | head -n 1)
56+
node_opts=""
57+
else
58+
master_addr=${master_addr:-"127.0.0.1"}
59+
node_opts="--nnodes=${nnodes:-1} --node_rank=${node_rank:-0}"
60+
fi
61+
master_port=${master_port:-23456}
62+
echo "MasterAddr=${master_addr}:${master_port}"
63+
echo "==================================="
64+
node_opts="${node_opts} --init_method=tcp://${master_addr}:${master_port}"
65+
66+
## init virtual environment if needed
67+
conda_home=${conda_home:-"${HOME}/.local/anaconda3"}
68+
. ${conda_home}/bin/activate profold2
69+
70+
exp=${exp:-"150m"}
71+
model_suffix=${model_suffix:-""}
72+
73+
export AxialAttention_accept_edge_norm=${AxialAttention_accept_edge_norm:-"0"}
74+
export AxialAttention_accept_kernel_fn=${AxialAttention_accept_kernel_fn:-"1"}
75+
# export AxialAttention_accept_kernel_dtype="float16"
76+
77+
export NCCL_SOCKET_FAMILY=AF_INET
78+
export NCCL_TIMEOUT=3600
79+
80+
runner="python"
81+
if [ x"${platform}" = x"slurm" ]; then
82+
runner="srun ${runner}"
83+
fi
84+
${runner} ${PWD}/main.py ${node_opts} generate \
85+
--prefix=${CWD}/${exp}.pred${model_suffix} \
86+
\
87+
--models ${CWD}/${exp}.folding/model.pth${model_suffix} \
88+
--map_location=cpu \
89+
--model_recycles=2 \
90+
--model_shard_size=256 \
91+
\
92+
--fasta_fmt=single \
93+
$*

install_env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ conda install -y -c nvidia/label/cuda-${cuda_version} \
6464

6565
conda install -y -c conda-forge \
6666
biopython \
67+
biotite \
6768
einops \
69+
rdkit \
6870
tensorboard \
6971
tqdm \
7072
&& cleanup

0 commit comments

Comments
 (0)