> This page is for Evo 2, version 2.2.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 2.2.0 (Latest) (default): https://docs.nvidia.com/nim/bionemo/evo2/2.2.0/llms.txt
> - 2.1.0: https://docs.nvidia.com/nim/bionemo/evo2/2.1.0/llms.txt
> - 2.0.0: https://docs.nvidia.com/nim/bionemo/evo2/2.0.0/llms.txt
> - 1.0.2: https://docs.nvidia.com/nim/bionemo/evo2/1.0.2/llms.txt
> - 1.0.1: https://docs.nvidia.com/nim/bionemo/evo2/1.0.1/llms.txt
> - 1.0.0: https://docs.nvidia.com/nim/bionemo/evo2/1.0.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/bionemo/llms.txt.

# Quickstart for Evo 2

> Start the Evo 2 NIM, check its health endpoint, and run your first DNA sequence generation request with Python and Shell clients.

This Quickstart Guide walks you through starting the Evo 2 NIM and running your first DNA sequence generation request. For models, hardware, software, and NGC account requirements, refer to the [Prerequisites](/nim/bionemo/evo2/get-started/prerequisites).

## Prerequisites

Confirm the following before you start the NIM.

<Note>
Ensure you install and set up [Prerequisite Software](/nim/bionemo/evo2/get-started/prerequisites) (Docker, NGC CLI, NGC registry access) before you begin.
</Note>

## Quickstart Steps

Complete the following steps to start the NIM and generate your first DNA sequences.

### Start the NIM

Follow these steps to start the NIM and confirm it is ready:

1. Export the `NGC_API_KEY` variable.

   ```bash
   export NGC_API_KEY=<your personal NGC key>
   ```

2. Set up a local cache directory.

   The NIM container downloads models automatically; providing a cache lets it reuse models it has already downloaded, saving time and bandwidth. Run the following command to set up the cache directory.

   ```bash
   export LOCAL_NIM_CACHE=~/.cache/nim
   mkdir -p "$LOCAL_NIM_CACHE"
   sudo chmod 0777 -R "$LOCAL_NIM_CACHE"
   ```

3. Run the NIM container with the following commands.

   <Note>
   - To use the **7B model**, add `-e NIM_VARIANT=7b` to the docker run command below. By default, the NIM loads the 40B model.
   - You might need to adjust your GPU's indices.
   </Note>

   ```bash
   docker run -it \
       --runtime=nvidia \
       --gpus='"device=0,1"' \
       -p 8000:8000 \
       -e NGC_API_KEY \
       -v "$LOCAL_NIM_CACHE":/opt/nim/.cache \
       nvcr.io/nim/arc/evo2:2
   ```

   This command starts the NIM container and exposes port 8000. The container defaults to the 40B model.

4. Open a new terminal, leaving the terminal with the service running.

5. Wait until the health endpoint returns `{"status":"ready"}` before proceeding.

   This can take a couple of minutes. In the new terminal, query the health endpoint with the following command.

   ```bash
   curl http://localhost:8000/v1/health/ready
   ```

### Generate DNA Sequences

The following examples use the DNA Sequence Generation (Prediction) functionality to get started with the NIM.

Both Python and Shell examples provide input DNA sequence, number of generated nucleotides (`num_tokens`), as well as some optional parameters. The outputs of the examples will contain JSON objects with generated DNA nucleotides: adenine (A), thymine (T), guanine (G), and cytosine (C) in the `sequence` field, as well as other optional fields, such as sampled probabilities per nucleotide.

For descriptions of the APIs and parameters, refer to [Evo 2 NIM Endpoints](/nim/bionemo/evo2/endpoints). For information on assessing model accuracy, refer to [Benchmarking with Evo 2 NIM](/nim/bionemo/evo2/benchmarking).

#### Python Client Example

The following is an example of how you can use a Python client to input a DNA sequence to generate its DNA nucleotides.

1. Save the following Python example to a file named `nim_client.py`.

   ```python
   #!/usr/bin/env python3
   import requests
   import os
   import json
   from pathlib import Path

   r = requests.post(
       url="http://localhost:8000/biology/arc/evo2/generate",
       json={
           "sequence": "ACTGACTGACTGACTG",
           "num_tokens": 8,
           "top_k": 1,
           "enable_sampled_probs": True,
       },
   )

   if "application/json" in r.headers.get("Content-Type", ""):
       print(r, "Saving to output.json:\n", r.text[:200], "...")
       Path("output.json").write_text(r.text)
   elif "application/zip" in r.headers.get("Content-Type", ""):
       print(r, "Saving large response to data.zip")
       Path("data.zip").write_bytes(r.content)
   else:
       print(r, r.headers, r.content)
   ```

2. Execute the example.

   ```bash
   chmod +x nim_client.py

   ./nim_client.py
   ```

3. The example saves results to the `output.json` file in JSON format. You can view the file using the following command:

   ```bash
   less output.json
   ```

#### Shell Client Example

Follow these steps to generate a DNA sequence with a Shell client:

1. Save the following Shell example to a file named `nim_client.sh`.

   ```bash
   #!/usr/bin/env bash
   set -e

   URL=http://localhost:8000/biology/arc/evo2/generate

   request='{
    "sequence": "ACTGACTGACTGACTG",
    "num_tokens": 8,
    "top_k": 1,
    "enable_sampled_probs": true
   }'
   curl -H 'Content-Type: application/json' \
        -d "$request" "$URL"
   ```

2. Execute the example.

   The example displays the results to the terminal in JSON format.

   ```bash
   chmod +x nim_client.sh

   ./nim_client.sh
   ```

## Next Steps

Now that you have a working setup, explore the following resources in greater detail:

<CardGroup cols={2}>
  <Card title="Endpoints" href="/evo2/endpoints">
    The Evo 2 NIM API endpoints, parameters, and outputs.
  </Card>
  <Card title="Benchmarking" href="/evo2/benchmarking">
    Accuracy and performance benchmarks for the NIM.
  </Card>
  <Card title="Advanced Usage" href="/evo2/advanced-usage">
    Select model variants and control logging.
  </Card>
  <Card title="Custom Models" href="/evo2/custom-models">
    Load custom and fine-tuned Evo 2 checkpoints.
  </Card>
</CardGroup>