Skip to content

Commit

Permalink
[lmi] support multimodal in lmi-dist
Browse files Browse the repository at this point in the history
  • Loading branch information
siddvenk committed Jul 17, 2024
1 parent aa473dc commit fc8ed66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def parse_chat_completions_request(input_map: Dict, is_rolling_batch: bool,
f"Cannot provide chat completion for tokenizer: {tokenizer.__class__}, "
f"please ensure that your tokenizer supports chat templates.")
chat_params = ChatProperties(**input_map)
param = chat_params.model_dump(by_alias=True, exclude_none=True)
exclude = {"messages"}
param = chat_params.model_dump(by_alias=True,
exclude_none=True,
exclude=exclude)
messages = chat_params.messages
images = []
tokenizer_inputs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from djl_python.rolling_batch.rolling_batch import RollingBatch, stop_on_any_exception, filter_unused_generation_params
from djl_python.rolling_batch.rolling_batch_vllm_utils import (
get_speculative_decoding_metrics_record, update_request_cache_with_output,
supports_speculative_decoding, get_lora_request_params, DTYPE_MAPPER)
supports_speculative_decoding, get_lora_request_params, DTYPE_MAPPER,
get_prompt_inputs)
from djl_python.telemetry import telemetry_manager
from djl_python.properties_manager.lmi_dist_rb_properties import LmiDistRbProperties

Expand Down Expand Up @@ -155,14 +156,16 @@ def inference(self, new_requests: List[Request]) -> List:
# step 0: register new requests to engine
for request in new_requests:
request_id = str(request.id)
llm_input = get_prompt_inputs(request)
params = self.translate_lmi_dist_params(request.parameters)
request_params = RequestParams(**params)
lora_request_params = get_lora_request_params(
request, self.lora_ids)
# Constructing Request in lmi-dist library
lmi_dist_request = Request(
id=request_id,
prompt=request.input_text,
prompt=llm_input.get("prompt"),
multi_modal_input=llm_input.get("multi_modal_data"),
params=request_params,
lora_request=lora_request_params["lora_request"]
if lora_request_params else None)
Expand Down

0 comments on commit fc8ed66

Please sign in to comment.