support Yi-Coder models
Former-commit-id: ea3f1659e70541c4fa8b7079a0a8c94fce9a41c8
This commit is contained in:
@@ -105,7 +105,7 @@ def _get_mm_inputs(
|
||||
It holds num_patches == torch.prod(image_grid_thw)
|
||||
"""
|
||||
image_processor: "BaseImageProcessor" = getattr(processor, "image_processor")
|
||||
input_dict = {"images": None, "videos": None}
|
||||
input_dict = {"images": None} # default key
|
||||
if len(images) != 0:
|
||||
images = _regularize_images(images, processor)
|
||||
input_dict["images"] = images
|
||||
@@ -114,7 +114,7 @@ def _get_mm_inputs(
|
||||
videos = _regularize_videos(videos, processor)
|
||||
input_dict["videos"] = videos
|
||||
|
||||
if input_dict["images"] is not None or input_dict["videos"] is not None:
|
||||
if input_dict.get("images", None) is not None or input_dict.get("videos", None) is not None:
|
||||
return image_processor(**input_dict, return_tensors="pt")
|
||||
else:
|
||||
return {}
|
||||
|
||||
@@ -1633,6 +1633,18 @@ register_model_group(
|
||||
DownloadSource.DEFAULT: "01-ai/Yi-1.5-34B-Chat",
|
||||
DownloadSource.MODELSCOPE: "01ai/Yi-1.5-34B-Chat",
|
||||
},
|
||||
"Yi-Coder-1.5B": {
|
||||
DownloadSource.DEFAULT: "01-ai/Yi-Coder-1.5B",
|
||||
},
|
||||
"Yi-Coder-9B": {
|
||||
DownloadSource.DEFAULT: "01-ai/Yi-Coder-9B",
|
||||
},
|
||||
"Yi-Coder-1.5B-Chat": {
|
||||
DownloadSource.DEFAULT: "01-ai/Yi-Coder-1.5B-Chat",
|
||||
},
|
||||
"Yi-Coder-9B-Chat": {
|
||||
DownloadSource.DEFAULT: "01-ai/Yi-Coder-9B-Chat",
|
||||
},
|
||||
},
|
||||
template="yi",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user