code: 
  
  
  
  import json
  import os
  import shutil
  import tempfile
  import unittest
  
  from transformers.models.wavaveca import WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor
  from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES
  from transformers.utils import FEATURE_EXTRACTOR_NAME
  
  from .test_feature_extraction_wavaveca import floats_list
  
  
  
  
  
  
  class 	lowercase		(				unittest.TestCase):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Union[str, Any]  )    ->				Tuple:
  							UpperCAmelCase_=     """<pad> <s> </s> <unk> | E T A O N I H S R D L U M W C F G Y P B V K ' X J Q Z""".split(""" """  )
  							UpperCAmelCase_=     dict(zip(__UpperCAmelCase		,						range(len(__UpperCAmelCase  )  )  )  )
  
  							UpperCAmelCase_=     {
  							    """pad_token""": """<pad>""",
  							    """unk_token""": """<unk>""",
  							    """bos_token""": """<s>""",
  							    """eos_token""": """</s>""",
  							}
  							UpperCAmelCase_=     {
  							    """feature_size""": 1,
  							    """padding_value""": 0.0,
  							    """sampling_rate""": 16_000,
  							    """return_attention_mask""": False,
  							    """do_normalize""": True,
  							}
  
  							UpperCAmelCase_=     tempfile.mkdtemp()
  							UpperCAmelCase_=     os.path.join(self.tmpdirname		,						VOCAB_FILES_NAMES["""vocab_file"""]  )
  							UpperCAmelCase_=     os.path.join(self.tmpdirname		,						__UpperCAmelCase  )
  							with open(self.vocab_file		,						"""w"""		,						encoding="""utf-8"""  ) as fp:
  													fp.write(json.dumps(__UpperCAmelCase  ) + """\n"""  )
  
  							with open(self.feature_extraction_file		,						"""w"""		,						encoding="""utf-8"""  ) as fp:
  													fp.write(json.dumps(__UpperCAmelCase  ) + """\n"""  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Any		,						**__UpperCAmelCase			:		Any  )    ->				Union[str, Any]:
  							UpperCAmelCase_=     self.add_kwargs_tokens_map.copy()
  							kwargs.update(__UpperCAmelCase  )
  							return WavaVecaCTCTokenizer.from_pretrained(self.tmpdirname		,						**__UpperCAmelCase  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]		,						**__UpperCAmelCase			:		List[Any]  )    ->				Union[str, Any]:
  							return WavaVecaFeatureExtractor.from_pretrained(self.tmpdirname		,						**__UpperCAmelCase  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		str  )    ->				Any:
  							shutil.rmtree(self.tmpdirname  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[Any]  )    ->				Optional[int]:
  							UpperCAmelCase_=     self.get_tokenizer()
  							UpperCAmelCase_=     self.get_feature_extractor()
  
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=__UpperCAmelCase		,						feature_extractor=__UpperCAmelCase  )
  
  							processor.save_pretrained(self.tmpdirname  )
  							UpperCAmelCase_=     WavaVecaProcessor.from_pretrained(self.tmpdirname  )
  
  							self.assertEqual(processor.tokenizer.get_vocab()		,						tokenizer.get_vocab()  )
  							self.assertIsInstance(processor.tokenizer		,						__UpperCAmelCase  )
  
  							self.assertEqual(processor.feature_extractor.to_json_string()		,						feature_extractor.to_json_string()  )
  							self.assertIsInstance(processor.feature_extractor		,						__UpperCAmelCase  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				List[str]:
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=self.get_tokenizer()		,						feature_extractor=self.get_feature_extractor()  )
  							processor.save_pretrained(self.tmpdirname  )
  
  							UpperCAmelCase_=     self.get_tokenizer(bos_token="""(BOS)"""		,						eos_token="""(EOS)"""  )
  							UpperCAmelCase_=     self.get_feature_extractor(do_normalize=__UpperCAmelCase		,						padding_value=1.0  )
  
  							UpperCAmelCase_=     WavaVecaProcessor.from_pretrained(
  							    self.tmpdirname		,						bos_token="""(BOS)"""		,						eos_token="""(EOS)"""		,						do_normalize=__UpperCAmelCase		,						padding_value=1.0  )
  
  							self.assertEqual(processor.tokenizer.get_vocab()		,						tokenizer_add_kwargs.get_vocab()  )
  							self.assertIsInstance(processor.tokenizer		,						__UpperCAmelCase  )
  
  							self.assertEqual(processor.feature_extractor.to_json_string()		,						feature_extractor_add_kwargs.to_json_string()  )
  							self.assertIsInstance(processor.feature_extractor		,						__UpperCAmelCase  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[str]  )    ->				Any:
  							UpperCAmelCase_=     self.get_feature_extractor()
  							UpperCAmelCase_=     self.get_tokenizer()
  
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=__UpperCAmelCase		,						feature_extractor=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     floats_list((3, 1_000)  )
  
  							UpperCAmelCase_=     feature_extractor(__UpperCAmelCase		,						return_tensors="""np"""  )
  							UpperCAmelCase_=     processor(__UpperCAmelCase		,						return_tensors="""np"""  )
  
  							for key in input_feat_extract.keys():
  													self.assertAlmostEqual(input_feat_extract[key].sum()		,						input_processor[key].sum()		,						delta=1E-2  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]  )    ->				Optional[Any]:
  							UpperCAmelCase_=     self.get_feature_extractor()
  							UpperCAmelCase_=     self.get_tokenizer()
  
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=__UpperCAmelCase		,						feature_extractor=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     """This is a test string"""
  
  							UpperCAmelCase_=     processor(text=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     tokenizer(__UpperCAmelCase  )
  
  							for key in encoded_tok.keys():
  													self.assertListEqual(encoded_tok[key]		,						encoded_processor[key]  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]  )    ->				Any:
  							UpperCAmelCase_=     self.get_feature_extractor()
  							UpperCAmelCase_=     self.get_tokenizer()
  
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=__UpperCAmelCase		,						feature_extractor=__UpperCAmelCase  )
  
  							UpperCAmelCase_=     [[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]
  
  							UpperCAmelCase_=     processor.batch_decode(__UpperCAmelCase  )
  							UpperCAmelCase_=     tokenizer.batch_decode(__UpperCAmelCase  )
  
  							self.assertListEqual(__UpperCAmelCase		,						__UpperCAmelCase  )
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		List[Any]  )    ->				Tuple:
  							UpperCAmelCase_=     self.get_feature_extractor()
  							UpperCAmelCase_=     self.get_tokenizer()
  
  							UpperCAmelCase_=     WavaVecaProcessor(tokenizer=__UpperCAmelCase		,						feature_extractor=__UpperCAmelCase  )
  
  							self.assertListEqual(
  							    processor.model_input_names		,						feature_extractor.model_input_names		,						msg="""`processor` and `feature_extractor` model input names do not match"""		,						)
  
  
  
  
  
style_context: 
  
  
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  __A       					=		logging.get_logger(__name__)
  
  __A       					=		{
      '''ZinengTang/tvlt-base''': '''https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json''',
  }
  
  
  
  
  
  
  class 	lowercase		(				snake_case__):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	a__   :      Tuple	     =							"tvlt"
  
  
  
  
  	def __init__(			self			:		List[str]		,						__UpperCAmelCase			:		List[str]=224		,						__UpperCAmelCase			:		List[str]=2_048		,						__UpperCAmelCase			:		Tuple=128		,						__UpperCAmelCase			:		Union[str, Any]=[16, 16]		,						__UpperCAmelCase			:		str=[16, 16]		,						__UpperCAmelCase			:		str=3		,						__UpperCAmelCase			:		List[str]=1		,						__UpperCAmelCase			:		Tuple=8		,						__UpperCAmelCase			:		Optional[Any]=768		,						__UpperCAmelCase			:		List[Any]=12		,						__UpperCAmelCase			:		Tuple=12		,						__UpperCAmelCase			:		List[str]=3_072		,						__UpperCAmelCase			:		List[Any]="gelu"		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		List[Any]=0.02		,						__UpperCAmelCase			:		Optional[int]=1E-6		,						__UpperCAmelCase			:		Tuple=True		,						__UpperCAmelCase			:		List[Any]=False		,						__UpperCAmelCase			:		Union[str, Any]=16		,						__UpperCAmelCase			:		Any=512		,						__UpperCAmelCase			:		Optional[Any]=8		,						__UpperCAmelCase			:		Dict=2_048		,						__UpperCAmelCase			:		Dict=0.75		,						__UpperCAmelCase			:		Union[str, Any]=0.15		,						__UpperCAmelCase			:		Any="frame-level"		,						__UpperCAmelCase			:		int=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		Union[str, Any]="classification"		,						**__UpperCAmelCase			:		Any		,						)    ->				Tuple:
  							super().__init__(**__UpperCAmelCase  )
  
  							if audio_mask_type not in ("frame-level", "patch_level"):
  													raise ValueError(
  													    """audio_mask_type must be one of two acceptable strategies - {'frame_level', 'patch-level') """
  													    F"""got {audio_mask_type}"""  )
  
  							UpperCAmelCase_=     image_size
  							UpperCAmelCase_=     spectrogram_length
  							UpperCAmelCase_=     frequency_length
  							UpperCAmelCase_=     image_patch_size
  							UpperCAmelCase_=     audio_patch_size
  							UpperCAmelCase_=     num_image_channels
  							UpperCAmelCase_=     num_audio_channels
  							UpperCAmelCase_=     num_frames
  
  							UpperCAmelCase_=     hidden_size
  							UpperCAmelCase_=     num_hidden_layers
  							UpperCAmelCase_=     num_attention_heads
  							UpperCAmelCase_=     intermediate_size
  							UpperCAmelCase_=     hidden_act
  							UpperCAmelCase_=     hidden_dropout_prob
  							UpperCAmelCase_=     attention_probs_dropout_prob
  							UpperCAmelCase_=     initializer_range
  							UpperCAmelCase_=     layer_norm_eps
  							UpperCAmelCase_=     qkv_bias
  							UpperCAmelCase_=     use_mean_pooling
  
  							UpperCAmelCase_=     decoder_num_attention_heads
  							UpperCAmelCase_=     decoder_hidden_size
  							UpperCAmelCase_=     decoder_num_hidden_layers
  							UpperCAmelCase_=     decoder_intermediate_size
  							UpperCAmelCase_=     pixel_mask_ratio
  							UpperCAmelCase_=     audio_mask_ratio
  							UpperCAmelCase_=     audio_mask_type
  
  							UpperCAmelCase_=     task_matching
  							UpperCAmelCase_=     task_mae
  							UpperCAmelCase_=     loss_type
  
  
  
  
  