
import unittest

from transformers import load_tool
from transformers.tools.agent_types import AGENT_TYPE_MAPPING

from .test_tools_common import ToolTesterMixin, output_types



class       a_   ( unittest.TestCase				, __UpperCAmelCase						):






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				load_tool("""translation"""     )
									self.tool.setup()
									_lowercase									=				load_tool("""translation"""							, remote=lowercase_     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				self.tool("""Hey, what\'s up?"""							, src_lang="""English"""							, tgt_lang="""French"""     )
									self.assertEqual(lowercase_							, """- Hé, comment ça va?"""     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				self.remote_tool("""Hey, what\'s up?"""							, src_lang="""English"""							, tgt_lang="""French"""     )
									self.assertEqual(lowercase_							, """- Hé, comment ça va?"""     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				self.tool(text="""Hey, what\'s up?"""							, src_lang="""English"""							, tgt_lang="""French"""     )
									self.assertEqual(lowercase_							, """- Hé, comment ça va?"""     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				self.remote_tool(text="""Hey, what\'s up?"""							, src_lang="""English"""							, tgt_lang="""French"""     )
									self.assertEqual(lowercase_							, """- Hé, comment ça va?"""     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				['''Hey, what\'s up?''', '''English''', '''Spanish''']
									_lowercase									=				self.tool(*lowercase_     )

									# There is a single output
									if len(self.tool.outputs     ) == 1:
															_lowercase									=				[outputs]

									self.assertListEqual(output_types(lowercase_     )							, self.tool.outputs     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				['''Hey, what\'s up?''', '''English''', '''Spanish''']
									_lowercase									=				self.tool(*lowercase_     )

									if not isinstance(lowercase_							, lowercase_     ):
															_lowercase									=				[outputs]

									self.assertEqual(len(lowercase_     )							, len(self.tool.outputs     )     )

									for output, output_type in zip(lowercase_							, self.tool.outputs     ):
															_lowercase									=				AGENT_TYPE_MAPPING[output_type]
															self.assertTrue(isinstance(lowercase_							, lowercase_     )     )






			def       UpperCamelCase_							(			self     ):
									_lowercase									=				['''Hey, what\'s up?''', '''English''', '''Spanish''']

									_lowercase									=				[]

									for _input, input_type in zip(lowercase_							, self.tool.inputs     ):
															if isinstance(lowercase_							, lowercase_     ):
																					_inputs.append([AGENT_TYPE_MAPPING[_input_type](_input     ) for _input_type in input_type]     )
															else:
																					_inputs.append(AGENT_TYPE_MAPPING[input_type](_input     )     )

        # Should not raise an error
									_lowercase									=				self.tool(*lowercase_     )

									if not isinstance(lowercase_							, lowercase_     ):
															_lowercase									=				[outputs]

									self.assertEqual(len(lowercase_     )							, len(self.tool.outputs     )     )






from ...configuration_utils import PretrainedConfig
from ...utils import logging


A		:   List[Any]         =    logging.get_logger(__name__)

A		:   str         =    {
    '''MCG-NJU/videomae-base''': '''https://huggingface.co/MCG-NJU/videomae-base/resolve/main/config.json''',
}



class       a_   ( _a						):
			a  : str				      =       '''videomae'''






			def __init__(			self							, __UpperCamelCase=224							, __UpperCamelCase=16							, __UpperCamelCase=3							, __UpperCamelCase=16							, __UpperCamelCase=2							, __UpperCamelCase=768							, __UpperCamelCase=12							, __UpperCamelCase=12							, __UpperCamelCase=3_072							, __UpperCamelCase="gelu"							, __UpperCamelCase=0.0							, __UpperCamelCase=0.0							, __UpperCamelCase=0.02							, __UpperCamelCase=1E-12							, __UpperCamelCase=True							, __UpperCamelCase=True							, __UpperCamelCase=6							, __UpperCamelCase=384							, __UpperCamelCase=4							, __UpperCamelCase=1_536							, __UpperCamelCase=True							, **__UpperCamelCase							, ):
									super().__init__(**__UpperCamelCase     )

									_lowercase									=				image_size
									_lowercase									=				patch_size
									_lowercase									=				num_channels
									_lowercase									=				num_frames
									_lowercase									=				tubelet_size

									_lowercase									=				hidden_size
									_lowercase									=				num_hidden_layers
									_lowercase									=				num_attention_heads
									_lowercase									=				intermediate_size
									_lowercase									=				hidden_act
									_lowercase									=				hidden_dropout_prob
									_lowercase									=				attention_probs_dropout_prob
									_lowercase									=				initializer_range
									_lowercase									=				layer_norm_eps
									_lowercase									=				qkv_bias
									_lowercase									=				use_mean_pooling

									_lowercase									=				decoder_num_attention_heads
									_lowercase									=				decoder_hidden_size
									_lowercase									=				decoder_num_hidden_layers
									_lowercase									=				decoder_intermediate_size
									_lowercase									=				norm_pix_loss