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: Main method to prepare for the model one or several sequences(s). This method forwards the `text` and `kwargs`
  arguments to the AutoTokenizer's [`~AutoTokenizer.__call__`] to encode the text. The method also proposes a
  voice preset which is a dictionary of arrays that conditions `Bark`'s output. `kwargs` arguments are forwarded
  to the tokenizer and to `cached_file` method if `voice_preset` is a valid filename.
  
  Args:
      text (`str`, `List[str]`, `List[List[str]]`):
          The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
          (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
          `is_split_into_words=True` (to lift the ambiguity with a batch of sequences).
      voice_preset (`str`, `Dict[np.ndarray]`):
          The voice preset, i.e the speaker embeddings. It can either be a valid voice_preset name, e.g
          `"en_speaker_1"`, or directly a dictionnary of `np.ndarray` embeddings for each submodel of `Bark`. Or
          it can be a valid file name of a local `.npz` single voice preset.
      return_tensors (`str` or [`~utils.TensorType`], *optional*):
          If set, will return tensors of a particular framework. Acceptable values are:
  
          - `'pt'`: Return PyTorch `torch.Tensor` objects.
          - `'np'`: Return NumPy `np.ndarray` objects.
  
  Returns:
      Tuple([`BatchEncoding`], [`BatchFeature`]): A tuple composed of a [`BatchEncoding`], i.e the output of the
      `tokenizer` and a [`BatchFeature`], i.e the voice preset with the right tensors type.
docstr_tok: ["Main","method","to","prepare","for","the","model","one","or","several","sequences","(","s",")",".","This","method","forwards","the","`","text","`","and","`","kwargs","`","arguments","to","the","AutoTokenizer","'s","[","`","~AutoTokenizer.__call__","`","]","to","encode","the","text",".","The","method","also","proposes","a","voice","preset","which","is","a","dictionary","of","arrays","that","conditions","`","Bark","`","'s","output",".","`","kwargs","`","arguments","are","forwarded","to","the","tokenizer","and","to","`","cached_file","`","method","if","`","voice_preset","`","is","a","valid","filename",".","Args",":","text","(","`","str","`",",","`","List","[","str","]","`",",","`","List","[","List","[","str","]","]","`",")",":","The","sequence","or","batch","of","sequences","to","be","encoded",".","Each","sequence","can","be","a","string","or","a","list","of","strings","(","pretokenized","string",")",".","If","the","sequences","are","provided","as","list","of","strings","(","pretokenized",")",",","you","must","set","`","is_split_into_words=True","`","(","to","lift","the","ambiguity","with","a","batch","of","sequences",")",".","voice_preset","(","`","str","`",",","`","Dict","[","np.ndarray","]","`",")",":","The","voice","preset",",","i.e","the","speaker","embeddings",".","It","can","either","be","a","valid","voice_preset","name",",","e.g","`","``","en_speaker_1","''","`",",","or","directly","a","dictionnary","of","`","np.ndarray","`","embeddings","for","each","submodel","of","`","Bark","`",".","Or","it","can","be","a","valid","file","name","of","a","local","`",".npz","`","single","voice","preset",".","return_tensors","(","`","str","`","or","[","`","~utils.TensorType","`","]",",","*","optional","*",")",":","If","set",",","will","return","tensors","of","a","particular","framework",".","Acceptable","values","are",":","-","`","'pt","'","`",":","Return","PyTorch","`","torch.Tensor","`","objects",".","-","`","'np","'","`",":","Return","NumPy","`","np.ndarray","`","objects",".","Returns",":","Tuple","(","[","`","BatchEncoding","`","]",",","[","`","BatchFeature","`","]",")",":","A","tuple","composed","of","a","[","`","BatchEncoding","`","]",",","i.e","the","output","of","the","`","tokenizer","`","and","a","[","`","BatchFeature","`","]",",","i.e","the","voice","preset","with","the","right","tensors","type","."]
code: def __call__(
      self,
      text=None,
      voice_preset=None,
      return_tensors="pt",
      max_length=256,
      add_special_tokens=False,
      return_attention_mask=True,
      return_token_type_ids=False,
      **kwargs,
  ):
      """
      Main method to prepare for the model one or several sequences(s). This method forwards the `text` and `kwargs`
      arguments to the AutoTokenizer's [`~AutoTokenizer.__call__`] to encode the text. The method also proposes a
      voice preset which is a dictionary of arrays that conditions `Bark`'s output. `kwargs` arguments are forwarded
      to the tokenizer and to `cached_file` method if `voice_preset` is a valid filename.
  
      Args:
          text (`str`, `List[str]`, `List[List[str]]`):
              The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
              (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
              `is_split_into_words=True` (to lift the ambiguity with a batch of sequences).
          voice_preset (`str`, `Dict[np.ndarray]`):
              The voice preset, i.e the speaker embeddings. It can either be a valid voice_preset name, e.g
              `"en_speaker_1"`, or directly a dictionnary of `np.ndarray` embeddings for each submodel of `Bark`. Or
              it can be a valid file name of a local `.npz` single voice preset.
          return_tensors (`str` or [`~utils.TensorType`], *optional*):
              If set, will return tensors of a particular framework. Acceptable values are:
  
              - `'pt'`: Return PyTorch `torch.Tensor` objects.
              - `'np'`: Return NumPy `np.ndarray` objects.
  
      Returns:
          Tuple([`BatchEncoding`], [`BatchFeature`]): A tuple composed of a [`BatchEncoding`], i.e the output of the
          `tokenizer` and a [`BatchFeature`], i.e the voice preset with the right tensors type.
      """
      if voice_preset is not None and not isinstance(
          voice_preset, dict
      ):
          if (
              isinstance(voice_preset, str)
              and self.speaker_embeddings is not None
              and voice_preset in self.speaker_embeddings
          ):
              voice_preset = self._load_voice_preset(voice_preset)
  
          else:
              if isinstance(
                  voice_preset, str
              ) and not voice_preset.endswith(".npz"):
                  voice_preset = voice_preset + ".npz"
  
              voice_preset = np.load(voice_preset)
  
      if voice_preset is not None:
          self._validate_voice_preset_dict(voice_preset, **kwargs)
          voice_preset = BatchFeature(
              data=voice_preset, tensor_type=return_tensors
          )
  
      encoded_text = self.tokenizer(
          text,
          return_tensors=return_tensors,
          padding="max_length",
          max_length=max_length,
          return_attention_mask=return_attention_mask,
          return_token_type_ids=return_token_type_ids,
          add_special_tokens=add_special_tokens,
          **kwargs,
      )
  
      if voice_preset is not None:
          encoded_text["history_prompt"] = voice_preset
  
      return encoded_text
  
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 6 for calling the BarkProcessor obj's underlying member method code with example usage: obj.__call__(text, voice_preset, return_tensors, max_length, add_special_tokens, return_attention_mask, return_token_type_ids) and returns: encoded_text