Skip to navigation

Getting Started

View as Markdown

This section describes how to get the OpenFold2 NIM up and running.

  1. Pull and Run the NIM
  2. Submit Health Check Requests to the NIM
  3. Run Inference
  4. Stop the Container

This page assumes you have installed and set up Prerequisite Software (Docker, NGC CLI, NGC registry access).

Pull and Run the NIM

  1. Pull the NIM container.
docker pull nvcr.io/nim/openfold/openfold2:latest
  1. Run the NIM container and expose port 8000, to which the user can submit requests.

The command below starts the NIM container and exposes port 8000, to which the user can submit requests.

  • Set the LOCAL_NIM_CACHE environment variable to a location on the local filesystem, on a disk with at least 15 GB of space. Initially, the command below downloads model parameter sets to this location. On subsequent executions, the command below checks for the presence of the data, and only repeats the download if the data is not found. This download is approximately 5.2 GB.
export LOCAL_NIM_CACHE=~/.cache/nim
export NGC_API_KEY=<Your NGC API Key>
docker run --rm --name openfold2 \
--runtime=nvidia \
--gpus 'device=0' \
-p 8000:8000 \
-e NGC_API_KEY \
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
nvcr.io/nim/openfold/openfold2:latest

Submit Health Check Requests to the NIM

  1. Open a new terminal, leaving the current terminal open with the launched service.

  2. Submit requests to the health check endpoint until you see {"object":"health.response","message":"ready","status":"ready"}. It takes under 3 minutes for the NIM to start up and download the needed data files.

curl -X 'GET' \
'http://localhost:8000/v1/health/ready' \
-H 'accept: application/json'

You can also check the NIM’s status with Python by using the requests module, installed using pip install requests.

import requests
url = "http://localhost:8000/v1/health/ready" # Replace with the actual URL
headers = {"content-type": "application/json"}
try:
response = requests.get(url, headers=headers)
# Check if the request was successful
if response.ok:
print("Request succeeded:", response.json())
else:
print("Request failed:", response.status_code, response.text)
except Exception as E:
print("Request failed:", E)

When the response, {"object":"health.response","message":"ready","status":"ready"}, appears, the NIM is ready to accept a request with real inputs.

Run Inference

Refer to OpenFold2 NIM Example Requests for an example inference with realistic input.

Stop the Container

When you are done, press Ctrl+C in the terminal running the container, or run docker stop with the container name set by the --name option of the docker run command. Because the command uses --rm, Docker removes the container after it stops.