Sign inSign up

ddhmed/colabfold

By ddhmed

•Updated over 2 years ago

local ColabFold (1.5.5-cuda12.2.2) in Ubuntu amd64 GPU

Image
Machine learning & AI
0

107

ddhmed/colabfold repository overview

This image tags from ghcr.io/sokrypton/colabfold:1.5.5-cuda12.2.2 (https://github.com/sokrypton/ColabFold/wiki/Running-ColabFold-in-Docker⁠)

Usage:

sudo docker run -it --rm --gpus all -v $PWD/AlphaFold_params:/cache/colabfold -v $PWD/ColabFold_runner:/work -p 8001:8000 ghcr.io/sokrypton/colabfold:1.5.5-cuda12.2.2 /bin/bash

source activate colabfold

AlphaFold_params (empty file download_finished.txt is importance, otherwise algorithm will re-download the params):

-AlphaFold_params

|-- download_finished.txt

|-- LICENSE

|-- params_model_1.npz

|-- params_model_1_ptm.npz

|-- params_model_2.npz

|-- params_model_2_ptm.npz

|-- params_model_3.npz

|-- params_model_3_ptm.npz

|-- params_model_4.npz

|-- params_model_4_ptm.npz

|-- params_model_5.npz

|-- params_model_5_ptm.npz

Or use markahix/alphafold2:latest

Or you can build using dockerfile (https://github.com/YoshitakaMo/localcolabfold⁠):

# https://github.com/YoshitakaMo/localcolabfold
# https://hub.docker.com/r/biohpc/localcolabfold
########################################################
# 如支持GPU使用:From nvidia/cuda:11.8.0-devel-ubuntu22.04
# 不支持则:
# From datajoint/miniconda3:latest
### 作者和邮箱
#MAINTAINER ddhmed [email protected]
#
#USER root
#
#RUN apt update -y && apt install -y wget curl git
##COPY install_colabbatch_linux.sh /
#RUN cd / &&\
#    wget https://raw.githubusercontent.com/YoshitakaMo/localcolabfold/main/install_colabbatch_linux.sh &&\
#    chmod a+x *.sh &&\
#    bash install_colabbatch_linux.sh
#
#ENV PATH "$PATH:/colabfold_batch/bin"
########################################################
# 由于下载问题,网络问题,将install_colabbatch_linux.sh内容分解直接在dockerfile中安装,自行并下载weights上传;
# 通过dockerfile的multistage进行压缩;
# tag:20240523是仅使用builder构建的镜像,较大;tag:20240523_mini是使用multistage构建的镜像,较小;
########################################################
# docker build -t ddhmed/colabfold:20240523 .
# docker run时,目录不要覆盖/workspace
# docker run --gpus all -it --rm -v $PWD:/workspace/data -p 8000:8000 ddhmed/colabfold:20240609 /bin/bash
# pip install jupyterlab -i https://mirrors.aliyun.com/pypi/simple
# jupyter lab --allow-root --ip=0.0.0.0 --port=8000
# 使用colabfold_batch前,设置仅使用CPU:
# JAX_PLATFORMS=cuda colabfold_batch "input" "result/" --msa-mode 'mmseqs2_uniref_env' --num-models 1 --num-recycle 3 --stop-at-score 100 --num-relax 0 --relax-max-iterations 200
########################################################
# Stage 1: Build stage
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04

USER root

# Set the working directory
WORKDIR /workspace

# Install wget if it's not already installed
RUN apt-get update && apt-get install -y wget curl git

# Set environment variables
ENV COLABFOLDDIR=/workspace/localcolabfold
ENV PATH=${COLABFOLDDIR}/conda/condabin:${PATH}

# Create the directory for ColabFold
RUN mkdir -p ${COLABFOLDDIR}

# Download and install Mambaforge
RUN wget -q -P ${COLABFOLDDIR} https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh && \
    bash ${COLABFOLDDIR}/Mambaforge-Linux-x86_64.sh -b -p ${COLABFOLDDIR}/conda && \
    rm ${COLABFOLDDIR}/Mambaforge-Linux-x86_64.sh

# Initialize conda
RUN ${COLABFOLDDIR}/conda/bin/conda init

# Update conda
RUN ${COLABFOLDDIR}/conda/bin/conda update -n base conda -y

# Install required packages in base environment
RUN ${COLABFOLDDIR}/conda/bin/conda install -n base -c conda-forge -c bioconda \
    git python=3.10 openmm==7.7.0 pdbfixer \
    kalign2=2.04 hhsuite=3.3.0 mmseqs2=15.6f452 -y

# Install ColabFold and Jaxlib
RUN ${COLABFOLDDIR}/conda/bin/pip install --upgrade "jax[cuda11]" \
    -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.htm
#RUN ${COLABFOLDDIR}/conda/bin/pip install --upgrade "jax[cuda12]" \
#    -i https://mirrors.aliyun.com/pypi/simple
   
RUN ${COLABFOLDDIR}/conda/bin/pip install --no-warn-conflicts \
    "colabfold[alphafold-minus-jax] @ git+https://github.com/sokrypton/ColabFold" && \
    ${COLABFOLDDIR}/conda/bin/pip install "colabfold[alphafold]"
    
#RUN ${COLABFOLDDIR}/conda/bin/pip install --upgrade tensorflow && \
#    ${COLABFOLDDIR}/conda/bin/pip install silence_tensorflow
RUN ${COLABFOLDDIR}/conda/bin/pip install --upgrade tensorflow==2.14.0 && \
    ${COLABFOLDDIR}/conda/bin/pip install silence_tensorflow

# Download the updater script
COPY update_linux.sh ${COLABFOLDDIR}/
RUN chmod +x ${COLABFOLDDIR}/update_linux.sh
#RUN wget -qnc -O ${COLABFOLDDIR}/update_linux.sh \
#    https://raw.githubusercontent.com/YoshitakaMo/localcolabfold/main/update_linux.sh && \
#    chmod +x ${COLABFOLDDIR}/update_linux.sh

# Modify ColabFold scripts for non-GUI backend and custom cache directory
RUN cd ${COLABFOLDDIR}/conda/lib/python3.10/site-packages/colabfold && \
    sed -i -e "s#from matplotlib import pyplot as plt#import matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt#g" plot.py && \
    sed -i -e "s#appdirs.user_cache_dir(__package__ or \"colabfold\")#\"${COLABFOLDDIR}/colabfold\"#g" download.py && \
    sed -i -e "s#from io import StringIO#from io import StringIO\nfrom silence_tensorflow import silence_tensorflow\nsilence_tensorflow()#g" batch.py && \
    rm -rf __pycache__

# Download AlphaFold weights
COPY alphafold_params_colab_2022-12-06.tar ${COLABFOLDDIR}/colabfold/
COPY alphafold_params_2021-07-14.tar ${COLABFOLDDIR}/colabfold/
RUN ${COLABFOLDDIR}/conda/bin/python3 -m colabfold.download alphafold2_multimer_v3
RUN ${COLABFOLDDIR}/conda/bin/python3 -m colabfold.download AlphaFold2-ptm
# Extract the AlphaFold parameters file
#RUN mkdir -p ${COLABFOLDDIR}/colabfold/params && \
#    tar -xvf ${COLABFOLDDIR}/alphafold_params_colab_2022-12-06.tar -C ${COLABFOLDDIR}/colabfold/params && \
#    touch ${COLABFOLDDIR}/colabfold/params/download_finished.txt && \
#    rm ${COLABFOLDDIR}/alphafold_params_colab_2022-12-06.tar

# Add ColabFold to PATH
ENV PATH=${COLABFOLDDIR}/conda/bin:$PATH

# Print installation completion message
RUN echo "Download of AlphaFold2 weights finished." && \
    echo "-----------------------------------------" && \
    echo "Installation of ColabFold finished." && \
    echo "Add ${COLABFOLDDIR}/conda/bin to your PATH environment variable to run 'colabfold_batch'." && \
    echo -e "i.e. for Bash:\n\texport PATH=\"${COLABFOLDDIR}/conda/bin:\$PATH\"" && \
    echo "For more details, please run 'colabfold_batch --help'."
    

Tag summary

Content type

Image

Digest

sha256:c192caaf1…

Size

2.9 GB

Last updated

over 2 years ago

docker pull ddhmed/colabfold:1.5.5-cuda12.2.2