---
title: init
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/others/llmdatadistdev/llmpr_42_0005.html
sourcePath: /source/zh/canncommercial/900/others/llmdatadistdev/llmpr_42_0005.html
indexId: 880fcbd892cd9c91840131ce653d0cd5837594f0ccb216da5c158c4584368cd670
---
# init

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 | x |
| Atlas 训练系列产品 | x |


说明：针对 Atlas A2 训练系列产品 / Atlas A2 推理系列产品 ，仅支持Atlas 800I A2 推理服务器、A200I A2 Box 异构组件。


#### 函数功能

初始化LLMDataDist。通过单边建链，即Client向Server发起建链，Prompt作为Server，Decode作为Client；限制只能从Decode往Prompt拉取KV。


#### 函数原型

```
init(options: Dict[str, str])
```


#### 参数说明

| 参数名称 | 数据类型 | 取值说明 |
| --- | --- | --- |
| options | Dict[str, str] | 配置项。 传入的options可以通过LLMConfig来生成。 必填字段：device\_id和listen\_ip\_info（由于Prompt作为Server，必填；Decode作为Client无需填充listen\_ip\_info信息）。 |


#### 调用示例

```
from llm_datadist import LLMDataDist, LLMRole, LLMConfig
llm_datadist = LLMDataDist(LLMRole.PROMPT, 0)
llm_config = LLMConfig()
llm_config.listen_ip_info = "192.168.1.1:26000"
llm_config.device_id = 0
engine_options = llm_config.generate_options()
llm_datadist.init(engine_options)
```


#### 返回值

正常情况下无返回值。

异常情况会抛出LLMException。

参数错误可能抛出TypeError或ValueError。


#### 约束说明

初始化成功后，系统退出前需要调用finalize。
