mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-08-17 13:35:44 +08:00
[model] add MOSS-VL support (#10708)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
from types import SimpleNamespace
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
import numpy as np
|
||||
@@ -417,6 +418,24 @@ def test_qwen2_vl_plugin():
|
||||
_check_plugin(**check_inputs)
|
||||
|
||||
|
||||
def test_moss_vl_plugin():
|
||||
messages = [
|
||||
{"role": "user", "content": "First <image>, finally <image>."},
|
||||
{"role": "assistant", "content": "Done."},
|
||||
]
|
||||
expected_messages = [
|
||||
{"role": "user", "content": "First <|image_pad|>, finally <|image_pad|>."},
|
||||
{"role": "assistant", "content": "Done."},
|
||||
]
|
||||
processor = SimpleNamespace(image_processor=object(), video_processor=object())
|
||||
plugin = get_mm_plugin(name="moss_vl", image_token="<|image_pad|>", video_token="<|video_pad|>")
|
||||
|
||||
processed_messages = plugin.process_messages(messages, [object(), object()], [], [], processor)
|
||||
|
||||
assert processed_messages == expected_messages
|
||||
assert messages[0]["content"] == "First <image>, finally <image>."
|
||||
|
||||
|
||||
@pytest.mark.runs_on(["cpu", "mps"])
|
||||
@pytest.mark.skipif(not is_transformers_version_greater_than("4.57.0"), reason="Requires transformers>=4.57.0")
|
||||
def test_qwen3_vl_plugin():
|
||||
|
||||
Reference in New Issue
Block a user