Configuration Alternatives at Runtime#
This section provides a guide on how to run the OpenFold3 NIM with different settings for
port number for http requests
backend
template processing
These instructions assume
You have installed and set up Prerequisite Software (Docker, NGC CLI, NGC registry access).
You have pulled the container as described in Getting Started
Start the OpenFold3 NIM#
To start the NIM:
export NGC_API_KEY=<Your NGC API Key>
export LOCAL_NIM_CACHE=~/.cache/nim
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus 'device=0' \
-e NGC_API_KEY \
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
-p 8000:8000 \
--shm-size=16g \
nvcr.io/nim/openfold/openfold3:latest
Note
The meaning of the following docker run options are given below
The
-poption sets the port for the NIM.The
-eoptions define the environment variables, which are passed into the NIM’s container at runtime.The
--rmoption removes the container and associated file system usage when it exits / terminates.
Using an Alternative Port for OpenFold3 NIM Requests#
If you have other HTTP servers running (for example, other NIMs), you may need to make the 8000 port available by using another port for your NIM. To use an alternative port:
Change the exposed port by setting the
-poption.Set the
NIM_HTTP_API_PORTenvironment variable to the new port.
The following is an example of setting the NIM to run on port 6626:
export NGC_API_KEY=<Your NGC API Key>
export LOCAL_NIM_CACHE=/mount/largedisk/nim/.cache
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus 'device=0' \
-e NGC_API_KEY \
-e NIM_HTTP_API_PORT=6626 \ ## We must set the NIM_HTTP_API_PORT environment variable...
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
-p 6626:6626 \ ## as well as forward the port to host.
--shm-size=16g \
nvcr.io/nim/openfold/openfold3:latest
Backend Optimization Options#
By default, the NIM will run in TensorRT mode for supported GPUs. You can override the default backend optimization by setting the NIM_OPTIMIZED_BACKEND environment variable.
The following backend options are available:
trt(default): TensorRT with cuEquivariance kernels for optimized performance on supported GPUstorch: PyTorch with cuEquivariance kernels for GPU memory-management and accelerationtorch_baseline: PyTorch with DeepSpeed kernels for GPU memory-managment and acceleration
Running with PyTorch+cuEquivariance#
The following is an example of setting the NIM to run with PyTorch+cuEquivariance:
export NGC_API_KEY=<Your NGC API Key>
export LOCAL_NIM_CACHE=~/.cache/nim
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus 'device=0' \
-e NGC_API_KEY \
-e NIM_OPTIMIZED_BACKEND=torch \ ## Set the backend to PyTorch+cuEquivariance
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
-p 8000:8000 \
--shm-size=16g \
nvcr.io/nim/openfold/openfold3:latest
Running with PyTorch+DeepSpeed#
The following is an example of setting the NIM to run with PyTorch+DeepSpeed:
export NGC_API_KEY=<Your NGC API Key>
export LOCAL_NIM_CACHE=~/.cache/nim
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus 'device=0' \
-e NGC_API_KEY \
-e NIM_OPTIMIZED_BACKEND=torch_baseline \ ## Set the backend to PyTorch+DeepSpeed
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
-p 8000:8000 \
--shm-size=16g \
nvcr.io/nim/openfold/openfold3:latest
Template Configuration Options#
Configuring Template Chain Selection Threshold#
When using structural templates, the NIM validates that template chains have sufficient similarity to your query sequence. You can control the minimum score threshold using the CIF_DIRECT_MIN_SCORE environment variable.
Score Calculation:
score = sequence_identity × query_coverage
The variables are:
sequence_identity: Fraction of aligned residues that match between template and queryquery_coverage: Fraction of the query sequence covered by the alignment
Default Value: 0.1 (10% identity × coverage)
How It Works:
With
chain_idspecified: The specified chain in the input CIF string, is validated against the threshold. If the score is below the threshold, the template is rejected.Without
chain_id(automatic selection): All chains in the input CIF string are evaluated. The best matching chain is selected only if its score meets the threshold. If no chain meets the threshold, then no chain from the input CIF string is used.
Note
The chain_id parameter is specified in the inference request payload when providing structural templates. For example, in the templates field of your API request, you can include "chain_id": "A" to specify which chain from the input CIF string should be used for alignment validation.
Configuration Example:
export NGC_API_KEY=<Your NGC API Key>
export LOCAL_NIM_CACHE=~/.cache/nim
docker run --rm --name openfold3 \
--runtime=nvidia \
--gpus 'device=0' \
-e NGC_API_KEY \
-e CIF_DIRECT_MIN_SCORE=0.2 \ ## Set minimum score threshold to 0.2
-v $LOCAL_NIM_CACHE:/opt/nim/.cache \
-p 8000:8000 \
--shm-size=16g \
nvcr.io/nim/openfold/openfold3:latest
Guidance:
Lower values (0.05-0.15): More permissive, includes template sequence with very few residues in common with the query sequence.
Default value (0.1): Balanced approach for most use cases.
Higher values (0.2-0.4): More restrictive, includes only template sequences with many residues in common with the query sequence.