Skip to content

Commit

Permalink
Merge branch 'main' into renovate/jinja2-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Liana64 authored Jan 5, 2025
2 parents cfda3f1 + 321fdf0 commit 6eedd45
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ Container | Channel | Image
[ligandmpnn](https://github.com/RareCompute/containers/pkgs/container/ligandmpnn) | stable | ghcr.io/RareCompute/ligandmpnn
[protenix](https://github.com/RareCompute/containers/pkgs/container/protenix) | stable | ghcr.io/RareCompute/protenix
[protenix-develop](https://github.com/RareCompute/containers/pkgs/container/protenix-develop) | develop | ghcr.io/RareCompute/protenix-develop
[rfdiffusion](https://github.com/RareCompute/containers/pkgs/container/rfdiffusion) | stable | ghcr.io/RareCompute/rfdiffusion
[rfdiffusion-develop](https://github.com/RareCompute/containers/pkgs/container/rfdiffusion-develop) | develop | ghcr.io/RareCompute/rfdiffusion-develop


## Deprecations
Expand Down
81 changes: 81 additions & 0 deletions apps/rfdiffusion/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
FROM docker.io/library/python:3.9-slim-bookworm

LABEL \
maintainer="Liana64" \
org.opencontainers.image.source="https://github.com/RosettaCommons/RFdiffusion"

ARG TARGETPLATFORM
ARG VERSION
ARG CHANNEL
ARG DEBIAN_FRONTEND=noninteractive

ENV \
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility,graphics" \
UMASK="0002" \
LANG=C.UTF-8 \
TZ="Etc/UTC" \
USERNAME=rare \
DEBUG=0 \
UID=900 \
GID=900 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
PIP_ROOT_USER_ACTION=ignore \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_BREAK_SYSTEM_PACKAGES=1 \
UV_HTTP_TIMEOUT=1000 \
DGLBACKEND="pytorch"

USER root
WORKDIR /app

RUN \
groupadd --gid ${GID} ${USERNAME} \
&& useradd --uid ${UID} --gid ${GID} --create-home --shell /bin/bash ${USERNAME} \
&& apt-get update && apt-get install -y --no-install-recommends \
curl unzip catatonit \
nano vim tree git \
&& curl -LsSf https://astral.sh/uv/0.5.6/install.sh | sh \
&& . $HOME/.local/bin/env \
&& case "${CHANNEL}" in \
'stable') \
curl -fsSL -o /tmp/app.zip "https://github.com/RosettaCommons/RFdiffusion/archive/refs/tags/v${VERSION}.zip" \
&& unzip -q /tmp/app.zip -d /tmp/app \
&& cp -R /tmp/app/RFdiffusion-${VERSION}/* /app \
;; \
'develop') \
git clone https://github.com/amelie-iska/RFdiffusion.git /app \
;; \
esac \
&& cd /app \
&& uv pip install --system \
dgl==1.0.2+cu116 -f "https://data.dgl.ai/wheels/cu116/repo.html" \
torch==1.12.1+cu116 --extra-index-url "https://download.pytorch.org/whl/cu116" \
e3nn==0.3.3 \
wandb==0.12.0 \
pynvml==11.0.0 \
git+https://github.com/NVIDIA/dllogger#egg=dllogger \
decorator==5.1.0 \
hydra-core==1.3.2 \
pyrsistent==0.19.3 \
/app/env/SE3Transformer \
&& printf "UpdateMethod=docker\nBranch=master\nPackageVersion=%s\nPackageAuthor=[RareCompute](https://github.com/RareCompute)\n" "${VERSION}" > /app/package_info \
&& chown -R ${UID}:${GID} /app && chmod -R 755 /app \
&& uv pip install --no-deps --system /app \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /root/.cache /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& chsh -s /bin/bash

COPY --chown=${UID}:${GID} ./apps/rfdiffusion/entrypoint.sh /entrypoint.sh
RUN chmod -R 755 /entrypoint.sh

WORKDIR /models
VOLUME ["/models"]

USER ${USERNAME}
WORKDIR /app

ENTRYPOINT ["/usr/bin/catatonit", "--", "/entrypoint.sh"]
24 changes: 24 additions & 0 deletions apps/rfdiffusion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Chai

From the [upstream repository](https://github.com/RosettaCommons/RFdiffusion)

> RFdiffusion is an open source method for structure generation, with or without conditional information (a motif, target etc). It can perform a whole range of protein design challenges as we have outlined in the RFdiffusion paper.
>
> Things Diffusion can do
>
> Motif Scaffolding
> Unconditional protein generation
> Symmetric unconditional generation (cyclic, dihedral and tetrahedral symmetries currently implemented, more coming!)
> Symmetric motif scaffolding
> Binder design
> Design diversification ("partial diffusion", sampling around a design)
## Environment variables

You can configure the docker image using the below environment variables

| Environment Variable | CLI Flag | Type | Default Value | Description |
| -------------------- | -------- | --------- | ------------- | -------------------------- |
| `USERNAME` | N/A | `STR` | `rare` | Username for the container |
| `UID` | N/A | `INTEGER` | `900` | UID for the container |
| `GID` | N/A | `INTEGER` | `900` | GID for the container |
5 changes: 5 additions & 0 deletions apps/rfdiffusion/ci/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/goss-org/goss/master/docs/schema.yaml
file:
/app/LICENSE:
exists: true
18 changes: 18 additions & 0 deletions apps/rfdiffusion/ci/latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
channel=$1

if [[ "${channel}" == "stable" ]]; then
version=$(curl -sX GET "https://api.github.com/repos/RosettaCommons/RFdiffusion/releases/latest" | jq --raw-output '.tag_name' 2>/dev/null)
version="${version#*v}"
version="${version#*release-}"
printf "%s" "${version}"
fi

if [[ "${channel}" == "develop" ]]; then
git clone --quiet https://github.com/amelie-iska/RFdiffusion.git /tmp/rfdiffusion
pushd /tmp/rfdiffusion > /dev/null || exit
version=$(git rev-list --count --first-parent HEAD)
popd > /dev/null || exit
rm -rf /tmp/rfdiffusion
printf "%s" "${version}"
fi
43 changes: 43 additions & 0 deletions apps/rfdiffusion/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

MODELS_PATH="/models"
BASE_URL="http://files.ipd.uw.edu/pub/RFdiffusion"

DOWNLOAD_ALL=$(echo "$DOWNLOAD_ALL" | tr '[:upper:]' '[:lower:]')
DOWNLOAD_COMPLEX_BETA=$(echo "$DOWNLOAD_COMPLEX_BETA" | tr '[:upper:]' '[:lower:]')
DOWNLOAD_STRUCTURE_PREDICTION_WEIGHTS=$(echo "$DOWNLOAD_STRUCTURE_PREDICTION_WEIGHTS" | tr '[:upper:]' '[:lower:]')

declare -A downloads=(
["Base_ckpt.pt"]="$BASE_URL/6f5902ac237024bdd0c176cb93063dc4/Base_ckpt.pt"
["Complex_base_ckpt.pt"]="$BASE_URL/e29311f6f1bf1af907f9ef9f44b8328b/Complex_base_ckpt.pt"
["Complex_Fold_base_ckpt.pt"]="$BASE_URL/60f09a193fb5e5ccdc4980417708dbab/Complex_Fold_base_ckpt.pt"
["InpaintSeq_ckpt.pt"]="$BASE_URL/74f51cfb8b440f50d70878e05361d8f0/InpaintSeq_ckpt.pt"
["InpaintSeq_Fold_ckpt.pt"]="$BASE_URL/76d00716416567174cdb7ca96e208296/InpaintSeq_Fold_ckpt.pt"
["ActiveSite_ckpt.pt"]="$BASE_URL/5532d2e1f3a4738decd58b19d633b3c3/ActiveSite_ckpt.pt"
["Base_epoch8_ckpt.pt"]="$BASE_URL/12fc204edeae5b57713c5ad7dcb97d39/Base_epoch8_ckpt.pt"
)

if [ "$DOWNLOAD_COMPLEX_BETA" == "true" ] || [ "$DOWNLOAD_ALL" == "true" ]; then
files["Complex_beta_ckpt.pt"]="$BASE_URL/f572d396fae9206628714fb2ce00f72e/Complex_beta_ckpt.pt"
fi

if [ "$DOWNLOAD_STRUCTURE_PREDICTION_WEIGHTS" == "true" ] || [ "$DOWNLOAD_ALL" == "true" ]; then
files["RF_structure_prediction_weights.pt"]="$BASE_URL/1befcb9b28e2f778f53d47f18b7597fa/RF_structure_prediction_weights.pt"
fi

for filename in "${!files[@]}"; do
filepath="$MODELS_PATH/$filename"
if [ ! -f "$filepath" ]; then
echo "Downloading $filename..."
wget -q -P $MODELS_PATH --timestamping "${files[$filename]}"
else
if [ $DEBUG -ne 0 ]; then
echo "Skipping $filename since it already exists"
fi
fi
done

exec \
python \
/app/scripts/run_inference.py \
"$@"
17 changes: 17 additions & 0 deletions apps/rfdiffusion/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
#yamllint disable
app: rfdiffusion
semver: true
channels:
- name: stable
platforms: ["linux/amd64"]
stable: true
tests:
enabled: false
type: cli
- name: develop
platforms: ["linux/amd64"]
stable: false
tests:
enabled: false
type: cli

0 comments on commit 6eedd45

Please sign in to comment.