[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:
@@ -714,10 +714,6 @@ class FunASRProcessingInfo(BaseProcessingInfo):
|
|||||||
def get_hf_config(self) -> Qwen3Config:
|
def get_hf_config(self) -> Qwen3Config:
|
||||||
return self.ctx.get_hf_config(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]:
|
def get_supported_mm_limits(self) -> Mapping[str, int | None]:
|
||||||
return {"audio": 1}
|
return {"audio": 1}
|
||||||
|
|
||||||
@@ -727,6 +723,13 @@ class FunASRProcessingInfo(BaseProcessingInfo):
|
|||||||
assert isinstance(feature_extractor, FunASRFeatureExtractor)
|
assert isinstance(feature_extractor, FunASRFeatureExtractor)
|
||||||
return feature_extractor
|
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:
|
def get_target_channels(self) -> int:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -765,13 +768,6 @@ class FunASRDummyInputsBuilder(BaseDummyInputsBuilder[FunASRProcessingInfo]):
|
|||||||
|
|
||||||
|
|
||||||
class FunASRMultiModalProcessor(BaseMultiModalProcessor[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(
|
def _call_hf_processor(
|
||||||
self,
|
self,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
|
|||||||
Reference in New Issue
Block a user