[Bugfix] Reject tokenizer-less Qwen VL processor init (#54886)
Signed-off-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
da55494a12
commit
8a728663c1
@@ -144,6 +144,7 @@ def test_qwen3_omni_get_updates_use_audio_in_video(
|
|||||||
|
|
||||||
# Create a mock context
|
# Create a mock context
|
||||||
mock_ctx = Mock(spec=InputProcessingContext)
|
mock_ctx = Mock(spec=InputProcessingContext)
|
||||||
|
mock_ctx.tokenizer = mock_tokenizer
|
||||||
|
|
||||||
# Create processing info
|
# Create processing info
|
||||||
info = Qwen3OmniMoeThinkerProcessingInfo(mock_ctx)
|
info = Qwen3OmniMoeThinkerProcessingInfo(mock_ctx)
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ class TerratorchInputBuilder(BaseDummyInputsBuilder[TerratorchProcessingInfo]):
|
|||||||
|
|
||||||
|
|
||||||
class TerratorchMultiModalProcessor(BaseMultiModalProcessor[TerratorchProcessingInfo]):
|
class TerratorchMultiModalProcessor(BaseMultiModalProcessor[TerratorchProcessingInfo]):
|
||||||
|
# Terratorch models, including Prithvi, consume tokenizer-free inputs.
|
||||||
|
requires_tokenizer = False
|
||||||
|
|
||||||
def _get_mm_fields_config(
|
def _get_mm_fields_config(
|
||||||
self,
|
self,
|
||||||
hf_inputs: BatchFeature,
|
hf_inputs: BatchFeature,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from enum import Enum
|
|||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
|
ClassVar,
|
||||||
Generic,
|
Generic,
|
||||||
NamedTuple,
|
NamedTuple,
|
||||||
Protocol,
|
Protocol,
|
||||||
@@ -1033,6 +1034,8 @@ class BaseMultiModalProcessor(ABC, Generic[_I]):
|
|||||||
Not to be confused with `transformers.ProcessorMixin`.
|
Not to be confused with `transformers.ProcessorMixin`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
requires_tokenizer: ClassVar[bool] = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
info: _I,
|
info: _I,
|
||||||
@@ -1042,6 +1045,13 @@ class BaseMultiModalProcessor(ABC, Generic[_I]):
|
|||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
if self.requires_tokenizer and info.ctx.tokenizer is None:
|
||||||
|
raise ValueError(
|
||||||
|
f"{type(self).__name__} requires a tokenizer and cannot be "
|
||||||
|
"initialized when `skip_tokenizer_init=True`. Disable "
|
||||||
|
"`--skip-tokenizer-init`."
|
||||||
|
)
|
||||||
|
|
||||||
self.info = info
|
self.info = info
|
||||||
self.dummy_inputs = dummy_inputs
|
self.dummy_inputs = dummy_inputs
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
|
|||||||
Reference in New Issue
Block a user