





import os
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path

from huggingface_hub import HfFolder, delete_repo
from huggingface_hub.file_download import http_get
from requests.exceptions import HTTPError

from transformers import (
    AlbertTokenizer,
    AutoTokenizer,
    BertTokenizer,
    BertTokenizerFast,
    GPTaTokenizerFast,
    is_tokenizers_available,
)
from transformers.testing_utils import TOKEN, USER, is_staging_test, require_tokenizers
from transformers.tokenization_utils import Trie


sys.path.append(str(Path(__file__).parent.parent / '''utils'''))

from test_module.custom_tokenization import CustomTokenizer  # noqa E402


if is_tokenizers_available():
		from test_module.custom_tokenization_fast import CustomTokenizerFast


class 						lowerCamelCase       (unittest.TestCase      ):







							"""simple docstring"""




							def  A_     ( self     :					str						)				->			Dict:





														"""simple docstring"""
														# A mock response for an HTTP head request to emulate server down
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						mock.Mock()
														SCREAMING_SNAKE_CASE__       :      int     =						5_0_0
														SCREAMING_SNAKE_CASE__       :      List[str]     =						{}
														SCREAMING_SNAKE_CASE__       :      Tuple     =						HTTPError
														SCREAMING_SNAKE_CASE__       :      Any     =						{}

														# Download this model to make sure it's in the cache.
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						BertTokenizer.from_pretrained("hf-internal-testing/tiny-random-bert"						)

														# Under the mock environment we get a 500 error when trying to reach the tokenizer.
														with mock.patch("requests.Session.request",			return_value=_UpperCAmelCase						) as mock_head:
																					SCREAMING_SNAKE_CASE__       :      Optional[int]     =						BertTokenizer.from_pretrained("hf-internal-testing/tiny-random-bert"						)
																					# This check we did call the fake head request
																					mock_head.assert_called()






							@require_tokenizers
							def  A_     ( self     :					Union[str, Any]						)				->			str:





														"""simple docstring"""
														# A mock response for an HTTP head request to emulate server down
														SCREAMING_SNAKE_CASE__       :      List[str]     =						mock.Mock()
														SCREAMING_SNAKE_CASE__       :      Any     =						5_0_0
														SCREAMING_SNAKE_CASE__       :      int     =						{}
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						HTTPError
														SCREAMING_SNAKE_CASE__       :      Dict     =						{}

														# Download this model to make sure it's in the cache.
														SCREAMING_SNAKE_CASE__       :      List[str]     =						GPTaTokenizerFast.from_pretrained("gpt2"						)

														# Under the mock environment we get a 500 error when trying to reach the tokenizer.
														with mock.patch("requests.Session.request",			return_value=_UpperCAmelCase						) as mock_head:
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						GPTaTokenizerFast.from_pretrained("gpt2"						)
																					# This check we did call the fake head request
																					mock_head.assert_called()






							def  A_     ( self     :					Tuple						)				->			List[str]:





														"""simple docstring"""
														# This test is for deprecated behavior and can be removed in v5
														try:
																					SCREAMING_SNAKE_CASE__       :      Dict     =						tempfile.mktemp()
																					with open(_UpperCAmelCase,			"wb"						) as f:
																												http_get("https://huggingface.co/albert-base-v1/resolve/main/spiece.model",			_UpperCAmelCase						)

																					SCREAMING_SNAKE_CASE__       :      List[Any]     =						AlbertTokenizer.from_pretrained(_UpperCAmelCase						)
														finally:
																					os.remove(_UpperCAmelCase						)

														# Supporting this legacy load introduced a weird bug where the tokenizer would load local files if they are in
														# the current folder and have the right name.
														if os.path.isfile("tokenizer.json"						):
																					# We skip the test if the user has a `tokenizer.json` in this folder to avoid deleting it.
																					return
														try:
																					with open("tokenizer.json",			"wb"						) as f:
																												http_get("https://huggingface.co/hf-internal-testing/tiny-random-bert/blob/main/tokenizer.json",			_UpperCAmelCase						)
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2"						)
																					# The tiny random BERT has a vocab size of 1024, tiny gpt2 as a vocab size of 1000
																					self.assertEqual(tokenizer.vocab_size,			1_0_0_0						)
																					# Tokenizer should depend on the remote checkpoint, not the local tokenizer.json file.

														finally:
																					os.remove("tokenizer.json"						)






							def  A_     ( self     :					str						)				->			Optional[Any]:





														"""simple docstring"""
														# This test is for deprecated behavior and can be removed in v5
														SCREAMING_SNAKE_CASE__       :      List[str]     =						AlbertTokenizer.from_pretrained("https://huggingface.co/albert-base-v1/resolve/main/spiece.model"						)


@is_staging_test
class 						lowerCamelCase       (unittest.TestCase      ):







							"""simple docstring"""




							UpperCAmelCase_      						=   ["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]", "bla", "blou"]






							@classmethod
							def  A_     ( cls     :					str						)				->			List[str]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						TOKEN
														HfFolder.save_token(_UpperCAmelCase						)






							@classmethod
							def  A_     ( cls     :					List[str]						)				->			int:





														"""simple docstring"""
														try:
																					delete_repo(token=cls._token,			repo_id="test-tokenizer"						)
														except HTTPError:
																					pass

														try:
																					delete_repo(token=cls._token,			repo_id="valid_org/test-tokenizer-org"						)
														except HTTPError:
																					pass

														try:
																					delete_repo(token=cls._token,			repo_id="test-dynamic-tokenizer"						)
														except HTTPError:
																					pass






							def  A_     ( self     :					Any						)				->			str:





														"""simple docstring"""
														with tempfile.TemporaryDirectory() as tmp_dir:
																					SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						os.path.join(_UpperCAmelCase,			"vocab.txt"						)
																					with open(_UpperCAmelCase,			"w",			encoding="utf-8"						) as vocab_writer:
																												vocab_writer.write("".join([x + "\n" for x in self.vocab_tokens]						)						)
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						BertTokenizer(_UpperCAmelCase						)

														tokenizer.push_to_hub("test-tokenizer",			use_auth_token=self._token						)
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						BertTokenizer.from_pretrained(F'''{USER}/test-tokenizer'''						)
														self.assertDictEqual(new_tokenizer.vocab,			tokenizer.vocab						)

														# Reset repo
														delete_repo(token=self._token,			repo_id="test-tokenizer"						)

														# Push to hub via save_pretrained
														with tempfile.TemporaryDirectory() as tmp_dir:
																					tokenizer.save_pretrained(_UpperCAmelCase,			repo_id="test-tokenizer",			push_to_hub=_UpperCAmelCase,			use_auth_token=self._token						)

														SCREAMING_SNAKE_CASE__       :      str     =						BertTokenizer.from_pretrained(F'''{USER}/test-tokenizer'''						)
														self.assertDictEqual(new_tokenizer.vocab,			tokenizer.vocab						)






							def  A_     ( self     :					List[Any]						)				->			str:





														"""simple docstring"""
														with tempfile.TemporaryDirectory() as tmp_dir:
																					SCREAMING_SNAKE_CASE__       :      List[str]     =						os.path.join(_UpperCAmelCase,			"vocab.txt"						)
																					with open(_UpperCAmelCase,			"w",			encoding="utf-8"						) as vocab_writer:
																												vocab_writer.write("".join([x + "\n" for x in self.vocab_tokens]						)						)
																					SCREAMING_SNAKE_CASE__       :      str     =						BertTokenizer(_UpperCAmelCase						)

														tokenizer.push_to_hub("valid_org/test-tokenizer-org",			use_auth_token=self._token						)
														SCREAMING_SNAKE_CASE__       :      int     =						BertTokenizer.from_pretrained("valid_org/test-tokenizer-org"						)
														self.assertDictEqual(new_tokenizer.vocab,			tokenizer.vocab						)

														# Reset repo
														delete_repo(token=self._token,			repo_id="valid_org/test-tokenizer-org"						)

														# Push to hub via save_pretrained
														with tempfile.TemporaryDirectory() as tmp_dir:
																					tokenizer.save_pretrained(
																					    _UpperCAmelCase,			repo_id="valid_org/test-tokenizer-org",			push_to_hub=_UpperCAmelCase,			use_auth_token=self._token						)

														SCREAMING_SNAKE_CASE__       :      Dict     =						BertTokenizer.from_pretrained("valid_org/test-tokenizer-org"						)
														self.assertDictEqual(new_tokenizer.vocab,			tokenizer.vocab						)






							@require_tokenizers
							def  A_     ( self     :					int						)				->			Tuple:





														"""simple docstring"""
														CustomTokenizer.register_for_auto_class()
														with tempfile.TemporaryDirectory() as tmp_dir:
																					SCREAMING_SNAKE_CASE__       :      int     =						os.path.join(_UpperCAmelCase,			"vocab.txt"						)
																					with open(_UpperCAmelCase,			"w",			encoding="utf-8"						) as vocab_writer:
																												vocab_writer.write("".join([x + "\n" for x in self.vocab_tokens]						)						)
																					SCREAMING_SNAKE_CASE__       :      Dict     =						CustomTokenizer(_UpperCAmelCase						)

														# No fast custom tokenizer
														tokenizer.push_to_hub("test-dynamic-tokenizer",			use_auth_token=self._token						)

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						AutoTokenizer.from_pretrained(F'''{USER}/test-dynamic-tokenizer''',			trust_remote_code=_UpperCAmelCase						)
														# Can't make an isinstance check because the new_model.config is from the CustomTokenizer class of a dynamic module
														self.assertEqual(tokenizer.__class__.__name__,			"CustomTokenizer"						)

														# Fast and slow custom tokenizer
														CustomTokenizerFast.register_for_auto_class()
														with tempfile.TemporaryDirectory() as tmp_dir:
																					SCREAMING_SNAKE_CASE__       :      int     =						os.path.join(_UpperCAmelCase,			"vocab.txt"						)
																					with open(_UpperCAmelCase,			"w",			encoding="utf-8"						) as vocab_writer:
																												vocab_writer.write("".join([x + "\n" for x in self.vocab_tokens]						)						)

																					SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						BertTokenizerFast.from_pretrained(_UpperCAmelCase						)
																					bert_tokenizer.save_pretrained(_UpperCAmelCase						)
																					SCREAMING_SNAKE_CASE__       :      List[Any]     =						CustomTokenizerFast.from_pretrained(_UpperCAmelCase						)

														tokenizer.push_to_hub("test-dynamic-tokenizer",			use_auth_token=self._token						)

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						AutoTokenizer.from_pretrained(F'''{USER}/test-dynamic-tokenizer''',			trust_remote_code=_UpperCAmelCase						)
														# Can't make an isinstance check because the new_model.config is from the FakeConfig class of a dynamic module
														self.assertEqual(tokenizer.__class__.__name__,			"CustomTokenizerFast"						)
														SCREAMING_SNAKE_CASE__       :      List[str]     =						AutoTokenizer.from_pretrained(
														    F'''{USER}/test-dynamic-tokenizer''',			use_fast=_UpperCAmelCase,			trust_remote_code=_UpperCAmelCase						)
														# Can't make an isinstance check because the new_model.config is from the FakeConfig class of a dynamic module
														self.assertEqual(tokenizer.__class__.__name__,			"CustomTokenizer"						)


class 						lowerCamelCase       (unittest.TestCase      ):







							"""simple docstring"""




							def  A_     ( self     :					List[str]						)				->			Optional[int]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      int     =						Trie()
														trie.add("Hello 友達"						)
														self.assertEqual(trie.data,			{"H": {"e": {"l": {"l": {"o": {" ": {"友": {"達": {"": 1}}}}}}}}}						)
														trie.add("Hello"						)
														trie.data
														self.assertEqual(trie.data,			{"H": {"e": {"l": {"l": {"o": {"": 1, " ": {"友": {"達": {"": 1}}}}}}}}}						)






							def  A_     ( self     :					Optional[int]						)				->			Optional[Any]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      List[str]     =						Trie()
														self.assertEqual(trie.split("[CLS] This is a extra_id_100"						),			["[CLS] This is a extra_id_100"]						)
														trie.add("[CLS]"						)
														trie.add("extra_id_1"						)
														trie.add("extra_id_100"						)
														self.assertEqual(trie.split("[CLS] This is a extra_id_100"						),			["[CLS]", " This is a ", "extra_id_100"]						)






							def  A_     ( self     :					int						)				->			Tuple:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      int     =						Trie()
														trie.add("A"						)
														self.assertEqual(trie.split("ABC"						),			["A", "BC"]						)
														self.assertEqual(trie.split("BCA"						),			["BC", "A"]						)






							def  A_     ( self     :					Any						)				->			Any:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						Trie()
														trie.add("TOKEN]"						)
														trie.add("[SPECIAL_TOKEN]"						)
														self.assertEqual(trie.split("This is something [SPECIAL_TOKEN]"						),			["This is something ", "[SPECIAL_TOKEN]"]						)






							def  A_     ( self     :					List[str]						)				->			int:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						Trie()
														trie.add("A"						)
														trie.add("P"						)
														trie.add("[SPECIAL_TOKEN]"						)
														self.assertEqual(trie.split("This is something [SPECIAL_TOKEN]"						),			["This is something ", "[SPECIAL_TOKEN]"]						)






							def  A_     ( self     :					Tuple						)				->			List[Any]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      str     =						Trie()
														trie.add("AB"						)
														trie.add("B"						)
														trie.add("C"						)
														self.assertEqual(trie.split("ABC"						),			["AB", "C"]						)






							def  A_     ( self     :					Union[str, Any]						)				->			Dict:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      Any     =						Trie()
														trie.add("ABC"						)
														trie.add("B"						)
														trie.add("CD"						)
														self.assertEqual(trie.split("ABCD"						),			["ABC", "D"]						)






							def  A_     ( self     :					Optional[int]						)				->			Dict:





														"""simple docstring"""
														# Even if the offsets are wrong, we necessarily output correct string
														# parts.
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						Trie()
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						trie.cut_text("ABC",			[0, 0, 2, 1, 2, 3]						)
														self.assertEqual(_UpperCAmelCase,			["AB", "C"]						)













import json
import os
from typing import Optional

import numpy as np

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


_lowerCamelCase :    Optional[int]  							= logging.get_logger(__name__)


class 						lowerCamelCase       (__lowerCamelCase      ):







							"""simple docstring"""




							UpperCAmelCase_      						=   "AutoTokenizer"
							UpperCAmelCase_      						=   ["tokenizer"]

							UpperCAmelCase_      						=   {
							    "semantic_prompt": 1,
							    "coarse_prompt": 2,
							    "fine_prompt": 2,
							}






							def __init__( self     :					Union[str, Any],			_UpperCAmelCase     :					Optional[int],			_UpperCAmelCase     :					Union[str, Any]=None						)				->			Union[str, Any]:





														"""simple docstring"""
														super().__init__(_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						speaker_embeddings






							@classmethod
							def  A_     ( cls     :					Any,			_UpperCAmelCase     :					List[str],			_UpperCAmelCase     :					Dict="speaker_embeddings_path.json",			**_UpperCAmelCase     :					Optional[Any]						)				->			List[Any]:





														"""simple docstring"""

														if speaker_embeddings_dict_path is not None:
																					SCREAMING_SNAKE_CASE__       :      Any     =						get_file_from_repo(
																					    _UpperCAmelCase,			_UpperCAmelCase,			subfolder=kwargs.pop("subfolder",			_UpperCAmelCase						),			cache_dir=kwargs.pop("cache_dir",			_UpperCAmelCase						),			force_download=kwargs.pop("force_download",			_UpperCAmelCase						),			proxies=kwargs.pop("proxies",			_UpperCAmelCase						),			resume_download=kwargs.pop("resume_download",			_UpperCAmelCase						),			local_files_only=kwargs.pop("local_files_only",			_UpperCAmelCase						),			use_auth_token=kwargs.pop("use_auth_token",			_UpperCAmelCase						),			revision=kwargs.pop("revision",			_UpperCAmelCase						),			)
																					if speaker_embeddings_path is None:
																												logger.warning(
																												    F'''`{os.path.join(_UpperCAmelCase,			_UpperCAmelCase						)}` 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`.'''						)
																												SCREAMING_SNAKE_CASE__       :      Dict     =						None
																					else:
																												with open(_UpperCAmelCase						) as speaker_embeddings_json:
																																			SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						json.load(_UpperCAmelCase						)
														else:
																					SCREAMING_SNAKE_CASE__       :      List[Any]     =						None

														SCREAMING_SNAKE_CASE__       :      List[str]     =						AutoTokenizer.from_pretrained(_UpperCAmelCase,			**_UpperCAmelCase						)

														return cls(tokenizer=_UpperCAmelCase,			speaker_embeddings=_UpperCAmelCase						)






							def  A_     ( self     :					str,			_UpperCAmelCase     :					Optional[int],			_UpperCAmelCase     :					List[str]="speaker_embeddings_path.json",			_UpperCAmelCase     :					Optional[Any]="speaker_embeddings",			_UpperCAmelCase     :					bool = False,			**_UpperCAmelCase     :					List[str],			)				->			Union[str, Any]:





														"""simple docstring"""
														if self.speaker_embeddings is not None:
																					os.makedirs(os.path.join(_UpperCAmelCase,			_UpperCAmelCase,			"v2"						),			exist_ok=_UpperCAmelCase						)

																					SCREAMING_SNAKE_CASE__       :      Optional[int]     =						{}

																					SCREAMING_SNAKE_CASE__       :      Any     =						save_directory

																					for prompt_key in self.speaker_embeddings:
																												if prompt_key != "repo_or_path":
																																			SCREAMING_SNAKE_CASE__       :      List[Any]     =						self._load_voice_preset(_UpperCAmelCase						)

																																			SCREAMING_SNAKE_CASE__       :      int     =						{}
																																			for key in self.speaker_embeddings[prompt_key]:
																																										np.save(
																																										    os.path.join(
																																										        embeddings_dict["repo_or_path"],			_UpperCAmelCase,			F'''{prompt_key}_{key}'''						),			voice_preset[key],			allow_pickle=_UpperCAmelCase,			)
																																										SCREAMING_SNAKE_CASE__       :      List[str]     =						os.path.join(_UpperCAmelCase,			F'''{prompt_key}_{key}.npy'''						)

																																			SCREAMING_SNAKE_CASE__       :      Optional[int]     =						tmp_dict

																					with open(os.path.join(_UpperCAmelCase,			_UpperCAmelCase						),			"w"						) as fp:
																												json.dump(_UpperCAmelCase,			_UpperCAmelCase						)

														super().save_pretrained(_UpperCAmelCase,			_UpperCAmelCase,			**_UpperCAmelCase						)






							def  A_     ( self     :					List[Any],			_UpperCAmelCase     :					str = None,			**_UpperCAmelCase     :					List[Any]						)				->			List[str]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      str     =						self.speaker_embeddings[voice_preset]

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						{}
														for key in ["semantic_prompt", "coarse_prompt", "fine_prompt"]:
																					if key not in voice_preset_paths:
																												raise ValueError(
																												    F'''Voice preset unrecognized, missing {key} as a key in self.speaker_embeddings[{voice_preset}].'''						)

																					SCREAMING_SNAKE_CASE__       :      List[Any]     =						get_file_from_repo(
																					    self.speaker_embeddings.get("repo_or_path",			"/"						),			voice_preset_paths[key],			subfolder=kwargs.pop("subfolder",			_UpperCAmelCase						),			cache_dir=kwargs.pop("cache_dir",			_UpperCAmelCase						),			force_download=kwargs.pop("force_download",			_UpperCAmelCase						),			proxies=kwargs.pop("proxies",			_UpperCAmelCase						),			resume_download=kwargs.pop("resume_download",			_UpperCAmelCase						),			local_files_only=kwargs.pop("local_files_only",			_UpperCAmelCase						),			use_auth_token=kwargs.pop("use_auth_token",			_UpperCAmelCase						),			revision=kwargs.pop("revision",			_UpperCAmelCase						),			)
																					if path is None:
																												raise ValueError(
																												    F'''`{os.path.join(self.speaker_embeddings.get("repo_or_path",			"/"						),			voice_preset_paths[key]						)}` does not exists
                    , no preloaded voice preset will be used - Make sure to provide correct paths to the {voice_preset}
                    embeddings.'''						)

																					SCREAMING_SNAKE_CASE__       :      int     =						np.load(_UpperCAmelCase						)

														return voice_preset_dict






							def  A_     ( self     :					int,			_UpperCAmelCase     :					Optional[dict] = None						)				->			Optional[int]:





														"""simple docstring"""
														for key in ["semantic_prompt", "coarse_prompt", "fine_prompt"]:
																					if key not in voice_preset:
																												raise ValueError(F'''Voice preset unrecognized, missing {key} as a key.'''						)

																					if not isinstance(voice_preset[key],			np.ndarray						):
																												raise ValueError(F'''{key} voice preset must be a {str(self.preset_shape[key]						)}D ndarray.'''						)

																					if len(voice_preset[key].shape						) != self.preset_shape[key]:
																												raise ValueError(F'''{key} voice preset must be a {str(self.preset_shape[key]						)}D ndarray.'''						)






							def __call__( self     :					List[Any],			_UpperCAmelCase     :					Optional[Any]=None,			_UpperCAmelCase     :					Union[str, Any]=None,			_UpperCAmelCase     :					Optional[int]="pt",			_UpperCAmelCase     :					List[str]=2_5_6,			_UpperCAmelCase     :					int=False,			_UpperCAmelCase     :					Optional[int]=True,			_UpperCAmelCase     :					Any=False,			**_UpperCAmelCase     :					List[str],			)				->			List[Any]:





														"""simple docstring"""
														if voice_preset is not None and not isinstance(_UpperCAmelCase,			_UpperCAmelCase						):
																					if (
																					    isinstance(_UpperCAmelCase,			_UpperCAmelCase						)
																					    and self.speaker_embeddings is not None
																					    and voice_preset in self.speaker_embeddings
																					):
																												SCREAMING_SNAKE_CASE__       :      List[str]     =						self._load_voice_preset(_UpperCAmelCase						)

																					else:
																												if isinstance(_UpperCAmelCase,			_UpperCAmelCase						) and not voice_preset.endswith(".npz"						):
																																			SCREAMING_SNAKE_CASE__       :      Optional[int]     =						voice_preset + ".npz"

																												SCREAMING_SNAKE_CASE__       :      List[str]     =						np.load(_UpperCAmelCase						)

														if voice_preset is not None:
																					self._validate_voice_preset_dict(_UpperCAmelCase,			**_UpperCAmelCase						)
																					SCREAMING_SNAKE_CASE__       :      Any     =						BatchFeature(data=_UpperCAmelCase,			tensor_type=_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      Dict     =						self.tokenizer(
														    _UpperCAmelCase,			return_tensors=_UpperCAmelCase,			padding="max_length",			max_length=_UpperCAmelCase,			return_attention_mask=_UpperCAmelCase,			return_token_type_ids=_UpperCAmelCase,			add_special_tokens=_UpperCAmelCase,			**_UpperCAmelCase,			)

														if voice_preset is not None:
																					SCREAMING_SNAKE_CASE__       :      str     =						voice_preset

														return encoded_text






