mindformers.pipeline.FillMaskPipeline

class mindformers.pipeline.FillMaskPipeline(model, tokenizer=None, **kwargs)[源代码]

Pipeline for mask fill

参数
  • model – a pretrained model (str or BaseModel) in _supproted_list.

  • tokenizer – a tokenizer (None or Tokenizer) for text processing

forward(model_inputs, **forward_params)[源代码]

Forward process

参数

model_inputs (dict) – outputs of preprocess.

返回

probs dict.

postprocess(model_outputs, **postprocess_params)[源代码]

Postprocess

参数

model_outputs (dict) – outputs of forward process.

返回

The generated results

preprocess(inputs, **preprocess_params)[源代码]

Preprocess of mask fill

参数
  • inputs (url, PIL.Image, tensor, numpy) – the image to be classified.

  • max_length (int) – max length of tokenizer’s output

  • padding (False / "max_length") – padding for max_length

  • return_tensors ("ms") – the type of returned tensors

返回

processed image.