
Follow the steps below to download and run the NVIDIA NIM inference microservice for this model on your infrastructure of choice.
NGC_API_KEY variable.export NGC_API_KEY=<your personal NGC key>
export LOCAL_NIM_CACHE=~/.cache/nim
mkdir -p "$LOCAL_NIM_CACHE"
sudo chmod 0777 -R "$LOCAL_NIM_CACHE"
$ docker login nvcr.io
Username: $oauthtoken
Password: <PASTE_API_KEY_HERE>
docker run -it \
--runtime=nvidia \
--gpus='"device=0"' \
-p 8000:8000 \
-e NGC_API_KEY \
-v "$LOCAL_NIM_CACHE":/opt/nim/.cache \
nvcr.io/nim/ipd/rfdiffusion:latest
This command will start the NIM container and expose port 8000 for the user to interact with the NIM.
{"status":"ready"} before proceeding. This may take a couple of minutes. You can use the following command to query the health check.curl http://localhost:8000/v1/health/ready
nim_client.py.#!/usr/bin/env python3
import requests
import os
import json
from pathlib import Path
def get_reduced_pdb():
pdb = Path("1R42.pdb")
if not pdb.exists():
pdb.write_text(requests.get(f"https://files.rcsb.org/download/{pdb}").text)
lines = filter(lambda line: line.startswith("ATOM"), pdb.read_text().split("\n"))
return "\n".join(list(lines)[:400])
r = requests.post(
url="http://localhost:8000/biology/ipd/rfdiffusion/generate",
json={
"input_pdb": get_reduced_pdb(),
"contigs": "A20-60/0 50-100",
"hotspot_res": ["A50","A51","A52","A53","A54"],
"diffusion_steps": 15,
},
)
print(r, "Saving to output.pdb:\n", r.text[:200], "...")
Path("output.pdb").write_text(json.loads(r.text)["output_pdb"])
chmod +x nim_client.py
./nim_client.py
output.pdb file in PDB format. You can quickly view the file using the following command.less output.pdb
nim_client.sh.#!/usr/bin/env bash
set -e
URL=http://localhost:8000/biology/ipd/rfdiffusion/generate
if [ ! -e 1R42.pdb ]; then curl -O https://files.rcsb.org/download/1R42.pdb; fi
pdb=$(cat 1R42.pdb | grep ^ATOM | head -n 400 | awk '{printf "%s\\n", $0}')
request='{
"input_pdb": "'"$pdb"'",
"contigs": "A20-60/0 50-100",
"hotspot_res": ["A50","A51","A52","A53","A54"],
"diffusion_steps": 15
}'
curl -H 'Content-Type: application/json' \
-d "$request" "$URL"
chmod +x nim_client.sh
./nim_client.sh
For more details on getting started with this NIM, visit the NVIDIA NIM Docs.