API for Dynamically Loading LoRA

Function

Dynamically loads LoRA. When this API is called, the system determines whether loading and waiting can proceed based on the current LoRA status and returns the corresponding result.

Format

Operation type: POST

URL: https://{ip}:{port}/v1/load_lora_adapter

  • {ip} is the value of managementIpAddress under ServerConfig in the config.json file. The default value is 127.0.0.2.
  • {port} is the value of managementPort under ServerConfig in the config.json file. The default value is 1026.

Request Parameters

Parameter

Mandatory/Optional

Description

Value

lora_name

Mandatory

Name of the loaded LoRA.

String: not empty.

lora_path

Mandatory

Path of the loaded LoRA.

String: not empty. The value complies with the path standard and exists.

master_mode

Mandatory

Name of the loaded LoRA model.

String: not empty. If the value is empty, the main model name is used by default.

Usage Example

Request example:

curl -X POST 127.0.0.2:1026/v1/load_lora_adapter -d '{
    "lora_name": "lora1",
    "lora_path": "/home/data/Qwen2.5-7B-Instruct-lora296",
    "master_mode": "qwen2"
}'

Response example:

Success: Lora adpter 'lora1' added successfully.

Response status code:

  • Status code 200: The service status is normal, and the message body contains no content.
  • Other status codes: The service status is abnormal.

Output Description

Return Value

Type

Description

"Success: LoRA adapter '{loraName }' added successfully."

String

The LoRA is successfully loaded.

"The LoRA adapter '{loraName }' has already been added."

String

The LoRA has been loaded.

"The LoRA adapter '{loraName }' is waiting to unload."

String

The loaded LoRA is being uninstalled.

"Call to load LoRA method failed: The LoRA adapter '{loraName }' is invalid."

String

Invalid LoRA name.

"Call to load LoRA method failed: Loading LoRA '{loraName }' failed: No adapter found for {loraPath }'."

String

Invalid LoRA path.

"Call to load LoRA method failed: LoRA rank is greater than max_lora_rank."

String

The requested LoRA rank is greater than the maximum LoRA rank.

"Call to load LoRA method failed: The number of LoRA adapters exceeds 'max_loras', and none are currently unloading."

String

The number of requested LoRA adapters is greater than the maximum number of LoRAs.

"Call to load LoRA method failed: The number of LoRA adapters exceeds 'max_loras', some adapters are currently being unloaded."

String

The number of requested LoRA adapters is greater than the maximum number of LoRAs. Some adapters are being uninstalled.

"Call to load LoRA method failed: The LoRA command only supports Python graph, please check the model graph type."

String

Unsupported graph. Replace the cpp graph with the Python graph.