[trainer] fix vlm loss for transformers 4.49 (#7448)

This commit is contained in:
hoshi-hiyouga
2025-03-24 10:24:05 +08:00
committed by GitHub
parent 3612946dd9
commit 7203365b80
5 changed files with 21 additions and 4 deletions

View File

@@ -143,6 +143,9 @@ class MMPluginMixin:
) -> None:
r"""Validate if this model accepts the input modalities."""
image_processor: BaseImageProcessor = getattr(processor, "image_processor", None)
video_processor: BaseImageProcessor = getattr(
processor, "video_processor", getattr(processor, "image_processor", None)
)
feature_extractor: SequenceFeatureExtractor = getattr(processor, "feature_extractor", None)
if len(images) != 0 and self.image_token is None:
raise ValueError(
@@ -165,6 +168,9 @@ class MMPluginMixin:
if self.image_token is not None and image_processor is None:
raise ValueError("Image processor was not found, please check and update your processor config.")
if self.video_token is not None and video_processor is None:
raise ValueError("Video processor was not found, please check and update your processor config.")
if self.audio_token is not None and feature_extractor is None:
raise ValueError("Audio feature extractor was not found, please check and update your processor config.")