[model] add MOSS-VL support (#10708)

This commit is contained in:
SSSSuperC
2026-08-03 18:18:24 +08:00
committed by GitHub
parent 62ae362455
commit 713b5a3f95
16 changed files with 1432 additions and 8 deletions

View File

@@ -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():