下载
EN
注册

unlink

函数功能

在开启CacheManager的场景下,开启方式是在初始化LLMDataDist时设置llm.EnableCacheManager为1,调用此接口进行断链。

函数原型

unlink(comm_id: int)

参数说明

参数名称

数据类型

取值说明

comm_id

int

link接口的返回值

调用示例

 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
from llm_datadist import LLMDataDist, LLMRole, LlmConfig
device_id = 0
llm_datadist = LLMDataDist(LLMRole.PROMPT, 1)
options = {
    "ge.exec.deviceId": str(device_id),
    "llm.MemPoolConfig": "{\"memory_size\": 1073741824}"
}
llm_config = LlmConfig()
llm_config.enable_cache_manager = True
options.update(llm_config.generate_options())
llm_datadist.init(options)
rank_table = """
{
    "server_count": "2",
    "server_list": [
        {
            "device": [
                {
                    "device_id": "0",
                    "device_ip": "x.x.x.x",
                    "rank_id": "0"
                },
            ],
            "server_id": "x.x.x.x"
        },{
            "device": [
                {
                    "device_id": "0",
                    "device_ip": "x.x.x.x",
                    "rank_id": "0"
                },
            ],
            "server_id": "x.x.x.x"
        }
    ],
    "status": "completed",
    "version": "1.0"
}"""
comm_id = llm_datadist.link({1: 0, 2: 1}, rank_table)
print("init link suc:", comm_id)
llm_datadist.unlink(comm_id)

返回值

正常情况下无返回值。

异常场景会抛出LLMException异常。

约束说明

需要开启CacheManager模式。