mindformers.pipeline

mindformers.pipeline(task=None, model=None, tokenizer=None, image_processor=None, audio_processor=None, backend='ms', **kwargs)[source]

Pipeline for executing the inference flow of integrated tasks and models.

Parameters:
  • task (str, optional) – The task, now support ['text_generation', 'multi_modal_to_text_generation']. Default: None.

  • model (Union[str, PreTrainedModel, Model, Tuple[str, str]], optional) – The model used for task. Default: None.

  • tokenizer (PreTrainedTokenizerBase, optional) – The tokenizer of the model. Default: None.

  • image_processor (BaseImageProcessor, optional) – The image processor of the model. Default: None.

  • audio_processor (BaseAudioProcessor, optional) – The audio processor of the model. Default: None.

  • backend (str, optional) – The inference backend. Currently, only "ms" is supported. Default: "ms".

  • **kwargs (Any) – Refers to the kwargs description of the corresponding task pipeline.

Returns:

A task pipeline.

Raises:

KeyError – If the task or model is not supported.