Skip to navigation

Deploy the MolMIM NIM

View as MarkdownOpen in Claude

This guide provides a detailed walkthrough for deploying the MolMIM NIM container, including viewing the available container image tags, pulling the image, running it with the recommended options, and caching the model. For a fast first run, refer to the Quickstart Guide.

Prerequisites

Before you start, complete the following prerequisites:

  1. Install Docker, the NVIDIA Container Toolkit, and the NVIDIA drivers, and set up NGC registry access.

    Refer to Prerequisites.

  2. Generate an NGC API key and log in to nvcr.io.

Deploy the NIM

To deploy the MolMIM NIM, complete the following steps:

  1. View the available container image tags.

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

    ngc registry image info nvcr.io/nim/nvidia/molmim:1.0.0
  2. Pull the container image using one of the following commands.

    Using Docker:

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

    Using NGC:

    ngc registry image pull nvcr.io/nim/nvidia/molmim:1.0.0
  3. Run the container.

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

    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 can 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 remove the container automatically 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.

  4. (Optional) Cache the model checkpoint.

    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.

    # 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

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

Next Steps

Now that the MolMIM NIM is deployed, explore the following resources: