MCPcopy Create free account
hub / github.com/modelscope/modelscope / preprocess

Method preprocess

modelscope/pipelines/base.py:413–419  ·  view source on GitHub ↗

Provide default implementation based on preprocess_cfg and user can reimplement it

(self, inputs: Input, **preprocess_params)

Source from the content-addressed store, hash-verified

411 f'those {missing_keys} are missing')
412
413 def preprocess(self, inputs: Input, **preprocess_params) -> Dict[str, Any]:
414 """ Provide default implementation based on preprocess_cfg and user can reimplement it
415 """
416 assert self.preprocessor is not None, 'preprocess method should be implemented'
417 assert not isinstance(self.preprocessor, List),\
418 'default implementation does not support using multiple preprocessors.'
419 return self.preprocessor(inputs, **preprocess_params)
420
421 def forward(self, inputs: Dict[str, Any],
422 **forward_params) -> Dict[str, Any]:

Callers 4

_process_singleMethod · 0.95
_process_batchMethod · 0.95
generate_dummy_inputsMethod · 0.45

Calls 1

preprocessorMethod · 0.80

Tested by

no test coverage detected