





import unittest

from datasets import load_dataset

from transformers import load_tool

from .test_tools_common import ToolTesterMixin




class 	_UpperCAmelCase						( unittest.TestCase			,							_lowercase       ):




					def 						snake_case_		(    self							)    ->	Any:
							UpperCamelCase__								=						load_tool("""document-question-answering"""							)
							self.tool.setup()
							UpperCamelCase__								=						load_tool("""document-question-answering"""     ,   remote=__lowerCAmelCase							)




					def 						snake_case_		(    self							)    ->	Any:
							UpperCamelCase__								=						load_dataset("""hf-internal-testing/example-documents"""     ,   split="""test"""							)
							UpperCamelCase__								=						dataset[0]["""image"""]

							UpperCamelCase__								=						self.tool(__lowerCAmelCase     ,   """When is the coffee break?"""							)
							self.assertEqual(__lowerCAmelCase     ,   """11-14 to 11:39 a.m."""							)




					def 						snake_case_		(    self							)    ->	Union[str, Any]:
							UpperCamelCase__								=						load_dataset("""hf-internal-testing/example-documents"""     ,   split="""test"""							)
							UpperCamelCase__								=						dataset[0]["""image"""]

							UpperCamelCase__								=						self.remote_tool(__lowerCAmelCase     ,   """When is the coffee break?"""							)
							self.assertEqual(__lowerCAmelCase     ,   """11-14 to 11:39 a.m."""							)




					def 						snake_case_		(    self							)    ->	int:
							UpperCamelCase__								=						load_dataset("""hf-internal-testing/example-documents"""     ,   split="""test"""							)
							UpperCamelCase__								=						dataset[0]["""image"""]

							self.tool(document=__lowerCAmelCase     ,   question="""When is the coffee break?"""							)




					def 						snake_case_		(    self							)    ->	Optional[Any]:
							UpperCamelCase__								=						load_dataset("""hf-internal-testing/example-documents"""     ,   split="""test"""							)
							UpperCamelCase__								=						dataset[0]["""image"""]

							UpperCamelCase__								=						self.remote_tool(document=__lowerCAmelCase     ,   question="""When is the coffee break?"""							)
							self.assertEqual(__lowerCAmelCase     ,   """11-14 to 11:39 a.m."""							)












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


__lowerCAmelCase 	=      logging.get_logger(__name__)

__lowerCAmelCase 	=      {
    "MCG-NJU/videomae-base": "https://huggingface.co/MCG-NJU/videomae-base/resolve/main/config.json",
}




class 	_UpperCAmelCase						( _lowercase       ):
					__A        = "videomae"




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

							UpperCamelCase__								=						image_size
							UpperCamelCase__								=						patch_size
							UpperCamelCase__								=						num_channels
							UpperCamelCase__								=						num_frames
							UpperCamelCase__								=						tubelet_size

							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__								=						norm_pix_loss





