Skip to content

Import and deploy with NVIDIA NIM

プレミアム機能

DataRobotでNVIDIA Inference Microservices(NIM)を利用するには、GenAIのエクスペリメントとGPUを使用した推論のためのプレミアム機能にアクセスする必要があります。 これらの機能を有効にするには、DataRobotの担当者または管理者にお問い合わせください。

The DataRobot integration with the NVIDIA AI Enterprise Suite enables users to perform one-click deployment of NVIDIA Inference Microservices (NIM) on GPUs in DataRobot Serverless Compute. This process starts in the Registry, where you can import NIM containers from the NVIDIA AI Enterprise model catalog. The registered model is optimized for deployment to Console and is compatible with the DataRobot monitoring and governance framework.

NVIDIA NIMでは、評価とエージェントブループリントへの組み込みのためにワークベンチのプレイグラウンドに追加できる最適化された基本モデル、ベクターデータベースの作成に使われる埋め込みモデル、エージェントアプリケーションのセキュリティを確保するためにDataRobotのモデレーションフレームワークで使用するNVIDIA NeMo Guardrailsを提供します。

NVIDIA GPU Cloud (NGC)からインポート

レジストリのモデルタブで、利用可能なNIMモデルのギャラリーから登録モデルを作成し、モデル名とパフォーマンスプロファイルを選択して、モデルカードに記載されている情報を確認します。

NVIDIA NGCからインポート

  1. レジストリ > モデルタブで、モデルを登録の横にある をクリックし、NVIDIA NGCからインポートをクリックします。

  2. In the Import from NVIDIA NGC panel, on the Select NIM tab, click a NIM in the gallery.

    ギャラリーの検索

    To direct your search, you can Search, filter by Publisher, or click Sort by to order the gallery by date added or alphabetically (ascending or descending).

  3. NVIDIA NGCソースのモデル情報を確認し、次へをクリックします。

  4. モデルの登録タブで、以下のフィールドを設定し、登録をクリックします。

    フィールド 説明
    登録モデルの名前/登録済みのモデル
    登録バージョンの名前
    登録モデルのバージョン
    リソースバンドル
    NVIDIA NGCのAPIキー
    オプション設定
    登録バージョンの説明 このモデルパッケージが解決するビジネス上の問題、またはより一般的に、このバージョンで表されるモデルについて説明します。
    タグ

登録済みNVIDIA NIMをデプロイする

NVIDIA NIMが登録されたら、DataRobotのサーバーレス予測環境にデプロイします。

To deploy a registered model to a DataRobot Serverless environment:

  1. On the Registry > Models tab, locate and click the registered NIM, and then click the version to deploy.

  2. In the registered model version, you can [review the version information]{0}, then click Deploy.

  3. In the Prediction history and service health section, under Choose prediction environment, verify that the correct prediction environment with Platform: DataRobot Serverless is selected.

    Change DataRobot Serverless environments

    If the correct DataRobot Serverless environment isn't selected, click Change. On the Select prediction environment panel's DataRobot Serverless tab, select a different serverless prediction environment from the list.

  4. オプションで追加のデプロイ設定を構成。 その後、デプロイが構成されたら、モデルをデプロイをクリックします。

    トレーステーブルを有効にする

    To enable the [tracing table]{0} for the NIM deployment, ensure that you [enable prediction row storage]{1} in the data exploration (or challenger) settings and configure the deployment settings required to [define an association ID]{2}.

デプロイされたNVIDIA NIMで予測を作成

モデルがDataRobotサーバーレス予測環境にデプロイされたら、デプロイの予測タブからリアルタイムの予測スニペットにアクセスできます。 予測スニペットを実行するための要件は、モデルのタイプ(テキスト生成または非構造化)によって異なります。

DataRobotのレジストリにNIMを追加すると、LLMがテキスト生成モデルとしてインポートされ、ボルトオンのガバナンスAPIを使って、デプロイされたNIMと通信できるようになります。 他のタイプのモデルは非構造化モデルとしてインポートされ、NIMコンテナが提供するエンドポイントは、デプロイされたNIMと通信するために公開されます。 これにより、DataRobot Serverless Computeを使用してGPUインフラストラクチャにNIMをデプロイするために必要な柔軟性が得られます。

ターゲットタイプ サポートされているエンドポイントタイプ 説明
テキスト生成 /chat/completions
非構造化 /directAccess/nim/
非構造化(埋め込みモデル) 両方

CSV predictions endpoint use

With an imported text generation NIM, it is also possible to make requests to the /predictions endpoint (accepting CSV input). For CSV input submitted to the /predictions endpoint, ensure that you use promptText as the column name for user prompts to the text generation model. If the CSV input isn't provided in this format, those predictions do not appear in the deployment's [tracing table]{0}.

Text generation model endpoints

デプロイの予測 > 予測APIタブから予測APIスクリプティングコードにアクセスします。 For a text generation model, the endpoint link required is the base URL of the DataRobot deployment. For more information, see the Bolt-on Governance API documentation.

Prediction snippets for Private CA environments

For Self-managed AI Platform installations in a Private Certificate Authority (Private CA) environment, the snippets provided on the Predictions tab may need to be updated, depending on how your organization's IT team configured the Private CA environment.

If your organization's Private CA environment requires modifications to the provided prediction snippet, locate the following code:

Standard Prediction API scripting code
1
2
3
4
5
openai_client = OpenAI(
        base_url=CHAT_API_URL,
        api_key=API_KEY,
        _strict_response_validation=False
    )

Update the code above, making the following changes to allow the prediction snippet to access the Private CA bundle file:

Private CA 予測APIスクリプトコード
1
2
3
4
5
6
7
8
ctx = ssl.create_default_context(cafile="<full path to CA bundle file>")
http_client = openai.DefaultHttpxClient(verify=ctx)
openai_client = OpenAI(
    base_url=CHAT_API_URL,
    api_key=API_KEY,
    http_client=http_client,
    _strict_response_validation=False
) 

Unstructured model endpoints

デプロイの予測 > 予測APIタブから予測APIスクリプティングコードにアクセスします。 For unstructured models, endpoints provided by the NIM containers are exposed to enable communication with the deployed NIM. To determine how to construct the correct endpoint URL and send a request to a deployed NVIDIA NIM instance, refer to the documentation for the registered and deployed NIM, listed below.

Observability for direct access endpoints

Most unstructured models from NVIDIA NIM only provide access to the /directAccess/nim/ endpoint. This endpoint is compatible with a limited set of observability features. For example, accuracy and drift tracking is not supported for the /directAccess/nim/ endpoint.

To use the Prediction API scripting code, perform the following steps and use the send_request function to communicate with the model:

  1. Review the BASE_API_URL (line 4). This is the prefix of the endpoint. It automatically populates with the deployment's base URL.
  2. Retrieve the appropriate NIM_SUFFIX (line 10). This is the suffix of the NIM endpoint. Locate this suffix in the [NVIDIA NIM documentation for the deployed model]{0}.
  3. Construct the request payload (sample_payload, line 45). This request payload must be structured based on the model’s API specifications from the [NVIDIA NIM documentation for the deployed model]{0}.
予測APIスクリプトコード
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import requests

# Base API URL for the deployed NIM
BASE_API_URL = '{{ prediction_api_url }}' # noqa

# API Key for authentication
API_KEY = '{{ api_key }}'

# Define the NIM model-specific endpoint suffix (update from Runtime Logs or NIM documentation)
NIM_SUFFIX = 'v1/your-model-endpoint'  # Modify this based on the required model

# Construct the full API URL for the request
DEPLOYMENT_URL = f"{BASE_API_URL}/{NIM_SUFFIX}"

def send_request(payload: dict):
    """
    Sends a request to the deployed NIM model.

    Args:
        payload (dict): **User must structure this input based on the model's API specifications.**
                       Refer to the model’s documentation for the correct request format.

    Returns:
        dict: JSON response from the NIM model.

    Raises:
        Exception: If the request fails, an error message is displayed.
    """
    headers = {
        "Authorization": f"Bearer {API_KEY}",  # Add API key for authentication
        "Content-Type": "application/json"
    }

    try:
        response = requests.post(DEPLOYMENT_URL, json=payload, headers=headers)
        response.raise_for_status()  # Raise an error for bad responses (4xx, 5xx)
        return response.json()

    except requests.exceptions.RequestException as e:
        raise Exception(f"API request failed: {e} {response.json()}")

if __name__ == "__main__":
    # Construct this payload according to the model's documentation!
    # Example input structure (modify as per model API reference)
    sample_payload = {
        "input": "your_model_input_here"  # Replace with required input format from model docs
    }

    # Send request and print response
    try:
        result = send_request(sample_payload)
        print("API Response:", result)
    except Exception as error:
        print("Error:", error) 
Unstructured model NVIDIA NIM documentation list

For unstructured models, the required NIM endpoint can be found in the NIM documentation. The list below provides the documentation link required to assemble the NIM_SUFFIX and sample_payload.

Unstructured models with text generation support

Embedding models are imported and deployed as unstructured models while maintaining the ability to request chat completions. The following embedding models support both a direct access endpoint and a chat completions endpoint:

  • arctic-embed-l
  • llama-3.2-nv-embedqa-1b-v2
  • nv-embedqa-e5-v5
  • nv-embedqa-e5-v5-pb24h2
  • nv-embedqa-mistral-7b-v2
  • nvclip

Each embedding NIM is deployed as an unstructured model, providing a REST interface at /directAccess/nim/. In addition, these models are capable of returning chat completions, so the code snippet provides a BASE_API_URL with the /chat/completions endpoint used by (structured) text generation models. 予測APIスクリプティングコードを使用するには、下の表を確認して、各エンドポイントタイプにアクセスするために予測スニペットをどのように変更するかを確認してください。

エンドポイントのタイプ 要件
Direct access
チャット補完
予測APIスクリプトコード
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import requests

# Base API URL for the deployed NIM
BASE_API_URL = 'https://app.datarobot.com/api/v2/deployments/deployment_id/chat/completions' # noqa

# API Key for authentication
API_KEY = '{{ api_key }}'

# Define the NIM model-specific endpoint suffix (Refer NIM API Reference link to get right suffix)
NIM_SUFFIX = 'v1/your-model-endpoint'  # Modify this based on the required model

# Construct the full API URL for the request
DEPLOYMENT_URL = f"{BASE_API_URL}/{NIM_SUFFIX}"