Getting Started#
This section describes how to get the OpenFold2 NIM up and running.
Pull and Run the NIM
Submit Health Check Requests to the NIM
Run Inference
Note
This page assumes you have installed and set up Prerequisite Software (Docker, NGC CLI, NGC registry access).
Pull and Run the NIM#
Pull the NIM container.
docker pull nvcr.io/${__ngc_location}/${__container_name}:${__container_version}
Run the NIM container and expose port 8000, to which the user can submit requests.
The command below will start the NIM container and expose port 8000, to which the user can submit requests.
Set the
NIM_CACHE_EXTERNAL
environment variable to a location on the local filesystem, on a disk with at least 320GB of space. Initially, the command below will download model parameter sets and a protein structure dataset to this location. On subsequent executions, the command below will check for the presence of the data, and only repeat the download if the data is not found. Note: This download takes roughly “20 minutes” on a 1 Gbps internet connection.
There is also a compilation step on each execution of the command below, which takes about 4min, depending on your hardware.
export NIM_CACHE_EXTERNAL=~/.cache/nim
export NGC_API_KEY=<Your NGC API Key>
docker run --rm --name ${__container_name} \
--runtime=nvidia \
--gpus 'device=0' \
-p 8000:8000 \
-e NGC_API_KEY \
-v $NIM_CACHE_EXTERNAL:/opt/nim/.cache \
nvcr.io/${__ngc_location}/${__container_name}:${__container_version}
Submit Health-Check Requests to the NIM as it starts up#
Open a new terminal, leaving the current terminal open with the launched service.
Here we’ll submit requets to the health check endoint, until we see
{"status":"ready"}
. It takes rouhgly “25 minutes” for the NIM to start-up, download needed data files, and performed needed compilation.
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 request 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, {“status”:”ready”}, appears, the NIM is ready to accept a request with real inputs.
Run Inference#
Note see OpenFold2 NIM Example Requests for an example inference with realistic input.