Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix restful client depends on specific type #1331

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions xinference/client/restful/restful_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import requests

from ...types import LoRA, PeftModelConfig
from ..common import streaming_response_iterator

if TYPE_CHECKING:
Expand Down Expand Up @@ -866,26 +865,14 @@ def launch_model(

url = f"{self.base_url}/v1/models"

if peft_model_config is not None:
lora_list = [
LoRA.from_dict(model) for model in peft_model_config["lora_list"]
]
peft_model = PeftModelConfig(
lora_list,
peft_model_config["image_lora_load_kwargs"],
peft_model_config["image_lora_fuse_kwargs"],
)
else:
peft_model = None

# convert float to int or string since the RESTful API does not accept float.
if isinstance(model_size_in_billions, float):
model_size_in_billions = convert_float_to_int_or_str(model_size_in_billions)

payload = {
"model_uid": model_uid,
"model_name": model_name,
"peft_model_config": peft_model.to_dict() if peft_model else None,
"peft_model_config": peft_model_config,
"model_type": model_type,
"model_size_in_billions": model_size_in_billions,
"model_format": model_format,
Expand Down
Loading