mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 06:12:50 +08:00
fix vllm
Former-commit-id: 13ee1f5cec815590c5d290f0aca264e6d16ddd5d
This commit is contained in:
parent
5a7ff02806
commit
65699c29d4
@ -113,9 +113,9 @@ class VllmEngine(BaseEngine):
|
||||
messages[0]["content"] = IMAGE_PLACEHOLDER * len(images) + messages[0]["content"]
|
||||
|
||||
if self.template.mm_plugin.__class__.__name__ == "Qwen2vlPlugin": # temporary solution
|
||||
image_str = "<|vision_start|>" + self.template.mm_plugin.image_token + "<|vision_end|>"
|
||||
image_str = f"<|vision_start|>{self.template.mm_plugin.image_token}<|vision_end|>"
|
||||
else:
|
||||
image_str = self.template.mm_plugin.image_token
|
||||
image_str = self.template.mm_plugin.image_token or ""
|
||||
|
||||
paired_messages = [
|
||||
{"role": message["role"], "content": message["content"].replace(IMAGE_PLACEHOLDER, image_str)}
|
||||
|
@ -82,7 +82,7 @@ class BasePlugin:
|
||||
Pre-processes a single image.
|
||||
"""
|
||||
image_resolution: int = kwargs.get("image_resolution")
|
||||
if image.width * image.height > image_resolution:
|
||||
if (image.width * image.height) > image_resolution:
|
||||
resize_factor = math.sqrt(image_resolution / (image.width * image.height))
|
||||
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
||||
image = image.resize((width, height), resample=Image.NEAREST)
|
||||
|
Loading…
x
Reference in New Issue
Block a user