mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-18 20:27:57 +00:00
fix(vllm): do not set videos if we don't have any (#3885)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
32db787991
commit
26c4058be4
@ -219,13 +219,15 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
# Generate text using the LLM engine
|
# Generate text using the LLM engine
|
||||||
request_id = random_uuid()
|
request_id = random_uuid()
|
||||||
print(f"Generating text with request_id: {request_id}", file=sys.stderr)
|
print(f"Generating text with request_id: {request_id}", file=sys.stderr)
|
||||||
|
multi_modal_data = {}
|
||||||
|
if image_data:
|
||||||
|
multi_modal_data["image"] = image_data
|
||||||
|
if video_data:
|
||||||
|
multi_modal_data["video"] = video_data
|
||||||
outputs = self.llm.generate(
|
outputs = self.llm.generate(
|
||||||
{
|
{
|
||||||
"prompt": prompt,
|
"prompt": prompt,
|
||||||
"multi_modal_data": {
|
"multi_modal_data": multi_modal_data if multi_modal_data else None,
|
||||||
"image": image_data if image_data else None,
|
|
||||||
"video": video_data if video_data else None,
|
|
||||||
} if image_data or video_data else None,
|
|
||||||
},
|
},
|
||||||
sampling_params=sampling_params,
|
sampling_params=sampling_params,
|
||||||
request_id=request_id,
|
request_id=request_id,
|
||||||
@ -279,7 +281,7 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||||||
return image
|
return image
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading image {image_path}: {e}", file=sys.stderr)
|
print(f"Error loading image {image_path}: {e}", file=sys.stderr)
|
||||||
return self.load_video(image_path)
|
return None
|
||||||
|
|
||||||
def load_video(self, video_path: str):
|
def load_video(self, video_path: str):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user