mirror of
				https://github.com/hiyouga/LLaMA-Factory.git
				synced 2025-11-04 18:02:19 +08:00 
			
		
		
		
	[misc] update internvl constants (#7801)
This commit is contained in:
		
							parent
							
								
									fddcd43c88
								
							
						
					
					
						commit
						7500e761d3
					
				@ -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})
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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"] = [
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user