class_docstr: Constructs a Wav2Vec2 processor which wraps a Wav2Vec2 feature extractor, a Wav2Vec2 CTC tokenizer and a decoder
  with language model support into a single processor for language model boosted speech recognition decoding.
  
  Args:
      feature_extractor ([`Wav2Vec2FeatureExtractor`]):
          An instance of [`Wav2Vec2FeatureExtractor`]. The feature extractor is a required input.
      tokenizer ([`Wav2Vec2CTCTokenizer`]):
          An instance of [`Wav2Vec2CTCTokenizer`]. The tokenizer is a required input.
      decoder (`pyctcdecode.BeamSearchDecoderCTC`):
          An instance of [`pyctcdecode.BeamSearchDecoderCTC`]. The decoder is a required input.
class_docstr_tok: ["Constructs","a","Wav2Vec2","processor","which","wraps","a","Wav2Vec2","feature","extractor",",","a","Wav2Vec2","CTC","tokenizer","and","a","decoder","with","language","model","support","into","a","single","processor","for","language","model","boosted","speech","recognition","decoding",".","Args",":","feature_extractor","(","[","`","Wav2Vec2FeatureExtractor","`","]",")",":","An","instance","of","[","`","Wav2Vec2FeatureExtractor","`","]",".","The","feature","extractor","is","a","required","input",".","tokenizer","(","[","`","Wav2Vec2CTCTokenizer","`","]",")",":","An","instance","of","[","`","Wav2Vec2CTCTokenizer","`","]",".","The","tokenizer","is","a","required","input",".","decoder","(","`","pyctcdecode.BeamSearchDecoderCTC","`",")",":","An","instance","of","[","`","pyctcdecode.BeamSearchDecoderCTC","`","]",".","The","decoder","is","a","required","input","."]
docstr: Instantiate a [`Wav2Vec2ProcessorWithLM`] from a pretrained Wav2Vec2 processor.
  
  <Tip>
  
  This class method is simply calling Wav2Vec2FeatureExtractor's
  [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`], Wav2Vec2CTCTokenizer's
  [`~tokenization_utils_base.PreTrainedTokenizerBase.from_pretrained`], and
  [`pyctcdecode.BeamSearchDecoderCTC.load_from_hf_hub`].
  
  Please refer to the docstrings of the methods above for more information.
  
  </Tip>
  
  Args:
      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 feature extractor file saved using the
            [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`.
          - a path or url to a saved feature extractor JSON *file*, e.g.,
            `./my_model_directory/preprocessor_config.json`.
      **kwargs
          Additional keyword arguments passed along to both [`SequenceFeatureExtractor`] and
          [`PreTrainedTokenizer`]
docstr_tok: ["Instantiate","a","[","`","Wav2Vec2ProcessorWithLM","`","]","from","a","pretrained","Wav2Vec2","processor",".","<","Tip",">","This","class","method","is","simply","calling","Wav2Vec2FeatureExtractor's","[","`","~feature_extraction_utils.FeatureExtractionMixin.from_pretrained","`","]",",","Wav2Vec2CTCTokenizer's","[","`","~tokenization_utils_base.PreTrainedTokenizerBase.from_pretrained","`","]",",","and","[","`","pyctcdecode.BeamSearchDecoderCTC.load_from_hf_hub","`","]",".","Please","refer","to","the","docstrings","of","the","methods","above","for","more","information",".","<","\/Tip",">","Args",":","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","feature","extractor","file","saved","using","the","[","`","~SequenceFeatureExtractor.save_pretrained","`","]","method",",","e.g.",",","`",".\/my_model_directory\/","`",".","-","a","path","or","url","to","a","saved","feature","extractor","JSON","*","file","*",",","e.g.",",","`",".\/my_model_directory\/preprocessor_config.json","`",".","*","*","kwargs","Additional","keyword","arguments","passed","along","to","both","[","`","SequenceFeatureExtractor","`","]","and","[","`","PreTrainedTokenizer","`","]"]
code: def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
      r"""
      Instantiate a [`Wav2Vec2ProcessorWithLM`] from a pretrained Wav2Vec2 processor.
  
      <Tip>
  
      This class method is simply calling Wav2Vec2FeatureExtractor's
      [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`], Wav2Vec2CTCTokenizer's
      [`~tokenization_utils_base.PreTrainedTokenizerBase.from_pretrained`], and
      [`pyctcdecode.BeamSearchDecoderCTC.load_from_hf_hub`].
  
      Please refer to the docstrings of the methods above for more information.
  
      </Tip>
  
      Args:
          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 feature extractor file saved using the
                [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`.
              - a path or url to a saved feature extractor JSON *file*, e.g.,
                `./my_model_directory/preprocessor_config.json`.
          **kwargs
              Additional keyword arguments passed along to both [`SequenceFeatureExtractor`] and
              [`PreTrainedTokenizer`]
      """
      requires_backends(cls, "pyctcdecode")
      from pyctcdecode import BeamSearchDecoderCTC
  
      (
          feature_extractor,
          tokenizer,
      ) = super()._get_arguments_from_pretrained(
          pretrained_model_name_or_path, **kwargs
      )
  
      if os.path.isdir(pretrained_model_name_or_path) or os.path.isfile(
          pretrained_model_name_or_path
      ):
          decoder = BeamSearchDecoderCTC.load_from_dir(
              pretrained_model_name_or_path
          )
      else:
          # BeamSearchDecoderCTC has no auto class
          kwargs.pop("_from_auto", None)
          # snapshot_download has no `trust_remote_code` flag
          kwargs.pop("trust_remote_code", None)
  
          # make sure that only relevant filenames are downloaded
          language_model_filenames = os.path.join(
              BeamSearchDecoderCTC._LANGUAGE_MODEL_SERIALIZED_DIRECTORY,
              "*",
          )
          alphabet_filename = (
              BeamSearchDecoderCTC._ALPHABET_SERIALIZED_FILENAME
          )
          allow_patterns = [language_model_filenames, alphabet_filename]
  
          decoder = BeamSearchDecoderCTC.load_from_hf_hub(
              pretrained_model_name_or_path,
              allow_patterns=allow_patterns,
              **kwargs,
          )
  
      # set language model attributes
      for attribute in [
          "alpha",
          "beta",
          "unk_score_offset",
          "score_boundary",
      ]:
          value = kwargs.pop(attribute, None)
  
          if value is not None:
              cls._set_language_model_attribute(
                  decoder, attribute, value
              )
  
      # make sure that decoder's alphabet and tokenizer's vocab match in content
      missing_decoder_tokens = cls.get_missing_alphabet_tokens(
          decoder, tokenizer
      )
      if len(missing_decoder_tokens) > 0:
          raise ValueError(
              f"The tokens {missing_decoder_tokens} are defined in the tokenizer's "
              "vocabulary, but not in the decoder's alphabet. "
              f"Make sure to include {missing_decoder_tokens} in the decoder's alphabet."
          )
  
      return cls(
          feature_extractor=feature_extractor,
          tokenizer=tokenizer,
          decoder=decoder,
      )
  
imports: import os
  import warnings
  from contextlib import contextmanager, nullcontext
  from dataclasses import dataclass
  from multiprocessing import Pool, get_context, get_start_method
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Union
  import numpy
  from ...processing_utils import ProcessorMixin
  from ...utils import ModelOutput, logging, requires_backends
label_desc: Use image node_id 3 for calling the Wav2Vec2ProcessorWithLM obj's underlying member method code with example usage: obj.from_pretrained(cls, pretrained_model_name_or_path) and returns: cls