mindformers.AutoProcessor
- class mindformers.AutoProcessor[source]
This is a generic processor class that will be instantiated as one of the processor classes of the library when created with the
from_pretrained()
class method. This class cannot be instantiated directly using __init__() (throws an error).Examples
>>> from mindformers import AutoProcessor >>> processor = AutoProcessor.from_pretrained("bert_base_uncased")
- classmethod from_pretrained(yaml_name_or_path, **kwargs)[source]
From pretrain method, which instantiates a processor by YAML, directory or model_id from modelers.cn.
Warning
The API is experimental and may have some slight breaking changes in the next releases.
- Parameters
- Returns
A processor which inherited from ProcessorMixin.
- static register(config_class, processor_class, exist_ok=False)[source]
Register a new processor for this class.
Warning
The API is experimental and may have some slight breaking changes in the next releases.
- Parameters
config_class (PretrainedConfig) – The model config class.
processor_class (ProcessorMixin) – The processor class.
exist_ok (bool, optional) – If set to True, no error will be raised even if config_class already exists. Default:
False
.