class_docstr: Constructs a Bark processor which wraps a text tokenizer and optional Bark voice presets into a single processor.
  
  Args:
      tokenizer ([`PreTrainedTokenizer`]):
          An instance of [`PreTrainedTokenizer`].
      speaker_embeddings (`Dict[Dict[str]]`, *optional*):
          Optional nested speaker embeddings dictionary. The first level contains voice preset names (e.g
          `"en_speaker_4"`). The second level contains `"semantic_prompt"`, `"coarse_prompt"` and `"fine_prompt"`
          embeddings. The values correspond to the path of the corresponding `np.ndarray`. See
          [here](https://suno-ai.notion.site/8b8e8749ed514b0cbf3f699013548683?v=bc67cff786b04b50b3ceb756fd05f68c) for
          a list of `voice_preset_names`.
class_docstr_tok: ["Constructs","a","Bark","processor","which","wraps","a","text","tokenizer","and","optional","Bark","voice","presets","into","a","single","processor",".","Args",":","tokenizer","(","[","`","PreTrainedTokenizer","`","]",")",":","An","instance","of","[","`","PreTrainedTokenizer","`","]",".","speaker_embeddings","(","`","Dict","[","Dict","[","str","]","]","`",",","*","optional","*",")",":","Optional","nested","speaker","embeddings","dictionary",".","The","first","level","contains","voice","preset","names","(","e.g","`","``","en_speaker_4","''","`",")",".","The","second","level","contains","`","``","semantic_prompt","''","`",",","`","``","coarse_prompt","''","`","and","`","``","fine_prompt","''","`","embeddings",".","The","values","correspond","to","the","path","of","the","corresponding","`","np.ndarray","`",".","See","[","here","]","(","https",":","\/\/suno-ai.notion.site\/8b8e8749ed514b0cbf3f699013548683","?","v=bc67cff786b04b50b3ceb756fd05f68c",")","for","a","list","of","`","voice_preset_names","`","."]
docstr: Instantiate a Bark processor associated with a pretrained model.
  
  Args:
      pretrained_model_name_or_path (`str` or `os.PathLike`):
          This can be either:
  
          - a string, the *model id* of a pretrained [`BarkProcessor`] 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 saved using the [`~BarkProcessor.save_pretrained`]
            method, e.g., `./my_model_directory/`.
      speaker_embeddings_dict_path (`str`, *optional*, defaults to `"speaker_embeddings_path.json"`):
          The name of the `.json` file containing the speaker_embeddings dictionnary located in
          `pretrained_model_name_or_path`. If `None`, no speaker_embeddings is loaded.
      **kwargs
          Additional keyword arguments passed along to both
          [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`].
docstr_tok: ["Instantiate","a","Bark","processor","associated","with","a","pretrained","model",".","Args",":","pretrained_model_name_or_path","(","`","str","`","or","`","os.PathLike","`",")",":","This","can","be","either",":","-","a","string",",","the","*","model","id","*","of","a","pretrained","[","`","BarkProcessor","`","]","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","saved","using","the","[","`","~BarkProcessor.save_pretrained","`","]","method",",","e.g.",",","`",".\/my_model_directory\/","`",".","speaker_embeddings_dict_path","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","speaker_embeddings_path.json","''","`",")",":","The","name","of","the","`",".json","`","file","containing","the","speaker_embeddings","dictionnary","located","in","`","pretrained_model_name_or_path","`",".","If","`","None","`",",","no","speaker_embeddings","is","loaded",".","*","*","kwargs","Additional","keyword","arguments","passed","along","to","both","[","`","~tokenization_utils_base.PreTrainedTokenizer.from_pretrained","`","]","."]
code: def from_pretrained(
      cls,
      pretrained_processor_name_or_path,
      speaker_embeddings_dict_path="speaker_embeddings_path.json",
      **kwargs,
  ):
      r"""
      Instantiate a Bark processor associated with a pretrained model.
  
      Args:
          pretrained_model_name_or_path (`str` or `os.PathLike`):
              This can be either:
  
              - a string, the *model id* of a pretrained [`BarkProcessor`] 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 saved using the [`~BarkProcessor.save_pretrained`]
                method, e.g., `./my_model_directory/`.
          speaker_embeddings_dict_path (`str`, *optional*, defaults to `"speaker_embeddings_path.json"`):
              The name of the `.json` file containing the speaker_embeddings dictionnary located in
              `pretrained_model_name_or_path`. If `None`, no speaker_embeddings is loaded.
          **kwargs
              Additional keyword arguments passed along to both
              [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`].
      """
  
      if speaker_embeddings_dict_path is not None:
          speaker_embeddings_path = get_file_from_repo(
              pretrained_processor_name_or_path,
              speaker_embeddings_dict_path,
              subfolder=kwargs.pop("subfolder", None),
              cache_dir=kwargs.pop("cache_dir", None),
              force_download=kwargs.pop("force_download", False),
              proxies=kwargs.pop("proxies", None),
              resume_download=kwargs.pop("resume_download", False),
              local_files_only=kwargs.pop("local_files_only", False),
              token=kwargs.pop("use_auth_token", None),
              revision=kwargs.pop("revision", None),
          )
          if speaker_embeddings_path is None:
              logger.warning(
                  f"""`{os.path.join(pretrained_processor_name_or_path,speaker_embeddings_dict_path)}` does not exists
                      , no preloaded speaker embeddings will be used - Make sure to provide a correct path to the json
                      dictionnary if wanted, otherwise set `speaker_embeddings_dict_path=None`."""
              )
              speaker_embeddings = None
          else:
              with open(
                  speaker_embeddings_path
              ) as speaker_embeddings_json:
                  speaker_embeddings = json.load(
                      speaker_embeddings_json
                  )
      else:
          speaker_embeddings = None
  
      tokenizer = AutoTokenizer.from_pretrained(
          pretrained_processor_name_or_path, **kwargs
      )
  
      return cls(
          tokenizer=tokenizer, speaker_embeddings=speaker_embeddings
      )
  
file_path: transformers/src/transformers/models/bark/processing_bark.py
imports: import json
  import os
  from typing import Optional
  import numpy
  from ...feature_extraction_utils import BatchFeature
  from ...processing_utils import ProcessorMixin
  from ...utils import logging
  from ...utils.hub import get_file_from_repo
  from ..auto import AutoTokenizer
label_desc: Use image node_id 2 for calling the BarkProcessor obj's underlying member method code with example usage: obj.from_pretrained(cls, pretrained_processor_name_or_path, speaker_embeddings_dict_path) and returns: cls