AutoProcessor
Last updated
Last updated
( )
This is a generic processor class that will be instantiated as one of the processor classes of the library when created with the class method.
This class cannot be instantiated directly using __init__()
(throws an error).
from_pretrained
( pretrained_model_name_or_path**kwargs )
Parameters
pretrained_model_name_or_path (str
or os.PathLike
) — This can be either:
a string, the model id of a pretrained feature_extractor hosted inside a model repo on huggingface.co. Valid model ids can be located at the root-level, like bert-base-uncased
, or namespaced under a user or organization name, like dbmdz/bert-base-german-cased
.
a path to a directory containing a processor files saved using the save_pretrained()
method, e.g., ./my_model_directory/
.
cache_dir (str
or os.PathLike
, optional) — Path to a directory in which a downloaded pretrained model feature extractor should be cached if the standard cache should not be used.
force_download (bool
, optional, defaults to False
) — Whether or not to force to (re-)download the feature extractor files and override the cached versions if they exist.
resume_download (bool
, optional, defaults to False
) — Whether or not to delete incompletely received file. Attempts to resume the download if such a file exists.
proxies (Dict[str, str]
, optional) — A dictionary of proxy servers to use by protocol or endpoint, e.g., {'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}.
The proxies are used on each request.
token (str
or bool, optional) — The token to use as HTTP bearer authorization for remote files. If True
, will use the token generated when running huggingface-cli login
(stored in ~/.huggingface
).
revision (str
, optional, defaults to "main"
) — The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a git-based system for storing models and other artifacts on huggingface.co, so revision
can be any identifier allowed by git.
return_unused_kwargs (bool
, optional, defaults to False
) — If False
, then this function returns just the final feature extractor object. If True
, then this functions returns a Tuple(feature_extractor, unused_kwargs)
where unused_kwargs is a dictionary consisting of the key/value pairs whose keys are not feature extractor attributes: i.e., the part of kwargs
which has not been used to update feature_extractor
and is otherwise ignored.
trust_remote_code (bool
, optional, defaults to False
) — Whether or not to allow for custom models defined on the Hub in their own modeling files. This option should only be set to True
for repositories you trust and in which you have read the code, as it will execute code present on the Hub on your local machine.
kwargs (Dict[str, Any]
, optional) — The values in kwargs of any keys which are feature extractor attributes will be used to override the loaded values. Behavior concerning key/value pairs whose keys are not feature extractor attributes is controlled by the return_unused_kwargs
keyword parameter.
Instantiate one of the processor classes of the library from a pretrained model vocabulary.
The processor class to instantiate is selected based on the model_type
property of the config object (either passed as an argument or loaded from pretrained_model_name_or_path
if possible):
Passing token=True
is required when you want to use a private model.
Examples:
Copied
register
( config_classprocessor_classexist_ok = False )
Parameters
processor_class (FeatureExtractorMixin
) — The processor to register.
Register a new processor for this class.
align — (ALIGN model)
altclip — (AltCLIP model)
bark — (Bark model)
blip — (BLIP model)
blip-2 — (BLIP-2 model)
bridgetower — (BridgeTower model)
chinese_clip — (Chinese-CLIP model)
clap — (CLAP model)
clip — (CLIP model)
clipseg — (CLIPSeg model)
flava — (FLAVA model)
git — (GIT model)
groupvit — (GroupViT model)
hubert — (Hubert model)
idefics — (IDEFICS model)
instructblip — (InstructBLIP model)
layoutlmv2 — (LayoutLMv2 model)
layoutlmv3 — (LayoutLMv3 model)
markuplm — (MarkupLM model)
mctct — (M-CTC-T model)
mgp-str — (MGP-STR model)
oneformer — (OneFormer model)
owlvit — (OWL-ViT model)
pix2struct — (Pix2Struct model)
pop2piano — (Pop2Piano model)
sam — (SAM model)
sew — (SEW model)
sew-d — (SEW-D model)
speech_to_text — (Speech2Text model)
speech_to_text_2 — (Speech2Text2 model)
speecht5 — (SpeechT5 model)
trocr — (TrOCR model)
tvlt — (TVLT model)
unispeech — (UniSpeech model)
unispeech-sat — (UniSpeechSat model)
vilt — (ViLT model)
vision-text-dual-encoder — (VisionTextDualEncoder model)
wav2vec2 — (Wav2Vec2 model)
wav2vec2-conformer — (Wav2Vec2-Conformer model)
wavlm — (WavLM model)
whisper — (Whisper model)
xclip — (X-CLIP model)
config_class () — The configuration corresponding to the model to register.