Controlled Small Molecule Generation (Latest)
Controlled Small Molecule Generation (Latest)

Deployment Guide

This section provides additional details for the deployment of the MolMIM NIM container.

Container image tags can be seen with the command below, similar to other container images on NGC.

Copy
Copied!
            

ngc registry image info nvcr.io/nim/nvidia/molmim:1.0.0

Pull the container image using one of the following commands:

Docker

Copy
Copied!
            

docker pull nvcr.io/nim/nvidia/molmim:1.0.0

NGC

Copy
Copied!
            

ngc registry image pull nvcr.io/nim/nvidia/molmim:1.0.0

As in the Quickstart Guide, you can run the following command to start the MolMIM NIM.

Copy
Copied!
            

docker run --rm -it --name molmim --runtime=nvidia \ -e CUDA_VISIBLE_DEVICES=0 \ -e NGC_CLI_API_KEY \ -p 8000:8000 \ nvcr.io/nim/nvidia/molmim:1.0.0

We can break down the command into the following components. Some may be modified in a production setting to better suit the user’s desired application.

  • docker run: This is the command to run a new container from a Docker image.

  • --rm: This flag tells Docker to automatically remove the container when it exits. This property is useful for one-off runs or testing, as it prevents the container from being left behind.

  • -it: These flags combine to create an interactive terminal session within the container. -i keeps the standard input open, and -t allocates a pseudo-TTY.

  • --name molmim: This flag gives the container the name “molmim”.

  • --runtime=nvidia: This flag specifies the runtime to use for the container. In this case, it is set to “nvidia”, which is used for GPU acceleration.

  • -e CUDA_VISIBLE_DEVICES=0: This flag sets an environment variable CUDA_VISIBLE_DEVICES to the value “0”. This variable controls which GPU devices are visible to the container. In this case, it is set to 0, which means the container will only use the first GPU (if available).

  • -e NGC_CLI_API_KEY: This flag sets an environment variable NGC_CLI_API_KEY used for authentication with NVIDIA’s NGC (NVIDIA GPU Cloud) service.

  • -p 8000:8000: This flag maps port 8000 on the host machine to port 8000 in the container. This allows you to access the container’s services from the host machine.

  • nvcr.io/nim/nvidia/molmim:1.0.0: This is the Docker image name and tag. The image is hosted on NVIDIA’s container registry (nvcr.io) and is named molmim_nim. The tag 1.0.0 specifies a specific version of the image.

Model Checkpoint Caching

On initial startup, the container will download the MolMIM checkpoint from NGC. You can skip this download step on future runs by caching the model weights locally using a cache directory as in the example below.

Copy
Copied!
            

# Create the cache directory on the host machine export LOCAL_NIM_CACHE=~/.cache/nim mkdir -p "$LOCAL_NIM_CACHE" # Run the container with the cache directory mounted in the appropriate location docker run --rm -it --name molmim --runtime=nvidia \ -e CUDA_VISIBLE_DEVICES=0 \ -e NGC_CLI_API_KEY \ -v "$LOCAL_NIM_CACHE:/home/nvs/.cache/nim" \ -p 8000:8000 \ nvcr.io/nim/nvidia/molmim:1.0.0

Note

Caching the model checkpoint can save a considerable amount of time on subsequent container runs.

Previous Quickstart Guide
Next MolMIM Endpoints
© | | | | | | |. Last updated on Jul 25, 2024.