[misc] update internvl constants (#7801)

This commit is contained in:
Kingsley 2025-04-22 15:53:08 +08:00 committed by GitHub
parent 7f3c31f6f4
commit c91165a5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 22 deletions

View File

@ -552,9 +552,9 @@ class InternVLPlugin(BasePlugin):
if len(images) != 0 or len(videos) != 0:
pixel_values_list = _concatenate_list(image_video_patches)
mm_inputs["pixel_values"] = torch.stack(
[torch.tensor(patch_ndarray) for patch_ndarray in pixel_values_list]
)
# in the latest version of transformers,
# the pixel_values is a list of tensors not ndarray
mm_inputs["pixel_values"] = torch.stack(pixel_values_list)
if len(images) != 0:
mm_inputs.update({"image_num_patches": image_num_patches})

View File

@ -1002,33 +1002,37 @@ register_model_group(
register_model_group(
models={
"InternVL2.5-1B-MPO": {
DownloadSource.DEFAULT: "kingsley01/InternVL2_5-1B-MPO-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL2_5-1B-MPO-hf",
},
"InternVL2.5-2B-MPO": {
DownloadSource.DEFAULT: "kingsley01/InternVL2_5-2B-MPO-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL2_5-2B-MPO-hf",
},
"InternVL2.5-4B-MPO": {
DownloadSource.DEFAULT: "kingsley01/InternVL2_5-4B-MPO-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL2_5-4B-MPO-hf",
DownloadSource.DEFAULT: "OpenGVLab/InternVL2_5-2B-MPO-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL2_5-2B-MPO-hf",
},
"InternVL2.5-8B-MPO": {
DownloadSource.DEFAULT: "kingsley01/InternVL2_5-8B-MPO-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL2_5-8B-MPO-hf",
DownloadSource.DEFAULT: "OpenGVLab/InternVL2_5-8B-MPO-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL2_5-8B-MPO-hf",
},
"InternVL3-1B-hf": {
DownloadSource.DEFAULT: "kingsley01/InternVL3-1B-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL3-1B-hf",
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-1B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-1B-hf",
},
"InternVL3-2B-hf": {
DownloadSource.DEFAULT: "kingsley01/InternVL3-2B-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL3-2B-hf",
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-2B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-2B-hf",
},
"InternVL3-8B-hf": {
DownloadSource.DEFAULT: "kingsley01/InternVL3-8B-hf",
DownloadSource.MODELSCOPE: "llamafactory/InternVL3-8B-hf",
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-8B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-8B-hf",
},
"InternVL3-14B-hf": {
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-14B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-14B-hf",
},
"InternVL3-38B-hf": {
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-38B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-38B-hf",
},
"InternVL3-78B-hf": {
DownloadSource.DEFAULT: "OpenGVLab/InternVL3-78B-hf",
DownloadSource.MODELSCOPE: "OpenGVLab/InternVL3-78B-hf",
},
},
template="intern_vl",

View File

@ -162,7 +162,7 @@ def test_gemma3_plugin():
@pytest.mark.xfail(reason="Unknown error.")
def test_internvl_plugin():
image_seqlen = 256
tokenizer_module = _load_tokenizer_module(model_name_or_path="kingsley01/InternVL2_5-1B-MPO-hf")
tokenizer_module = _load_tokenizer_module(model_name_or_path="OpenGVLab/InternVL3-1B-hf")
internvl_plugin = get_mm_plugin("intern_vl", image_token="<image>", video_token="<video>")
check_inputs = {"plugin": internvl_plugin, **tokenizer_module}
check_inputs["expected_mm_messages"] = [