[bugfix] refactor FunASR's _get_data_parser (#34397)

Signed-off-by: zixiao <shunli.dsl@alibaba-inc.com>
Co-authored-by: zixiao <shunli.dsl@alibaba-inc.com>
This commit is contained in:
AllenDou
2026-02-12 15:26:49 +08:00
committed by GitHub
parent e9cd691132
commit 386bfe5d08

View File

@@ -714,10 +714,6 @@ class FunASRProcessingInfo(BaseProcessingInfo):
def get_hf_config(self) -> Qwen3Config:
return self.ctx.get_hf_config(Qwen3Config)
@property
def skip_prompt_length_check(self) -> bool:
return True # Because the encoder prompt is padded
def get_supported_mm_limits(self) -> Mapping[str, int | None]:
return {"audio": 1}
@@ -727,6 +723,13 @@ class FunASRProcessingInfo(BaseProcessingInfo):
assert isinstance(feature_extractor, FunASRFeatureExtractor)
return feature_extractor
def get_data_parser(self) -> MultiModalDataParser:
feature_extractor = self.get_feature_extractor()
return MultiModalDataParser(
target_sr=feature_extractor.sampling_rate,
target_channels=self.get_target_channels(),
)
def get_target_channels(self) -> int:
return 1
@@ -765,13 +768,6 @@ class FunASRDummyInputsBuilder(BaseDummyInputsBuilder[FunASRProcessingInfo]):
class FunASRMultiModalProcessor(BaseMultiModalProcessor[FunASRProcessingInfo]):
def _get_data_parser(self) -> MultiModalDataParser:
feature_extractor = self.info.get_feature_extractor()
return MultiModalDataParser(
target_sr=feature_extractor.sampling_rate,
target_channels=self.info.get_target_channels(),
)
def _call_hf_processor(
self,
prompt: str,