mindformers.pipeline.FillMaskPipeline¶
- class mindformers.pipeline.FillMaskPipeline(model, tokenizer=None, **kwargs)[源代码]¶
Pipeline for mask fill
- Args:
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
- Args:
model_inputs (dict): outputs of preprocess.
- Return:
probs dict.
- postprocess(model_outputs, **postprocess_params)[源代码]¶
Postprocess
- Args:
model_outputs (dict): outputs of forward process.
- Return:
The generated results
- preprocess(inputs, **preprocess_params)[源代码]¶
Preprocess of mask fill
- Args:
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
- Return:
processed image.