


import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
a : Dict		=				sys.version_info >= (3, 10)


def 		lowercase_  (     _UpperCamelCase=None       ,			_UpperCamelCase=None  ):


			'''simple docstring'''







			return field(default_factory=lambda: default       ,			metadata=__snake_case  )
@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				42
					__UpperCAmelCase            =				42
					__UpperCAmelCase            =				42
					__UpperCAmelCase            =				42




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				42
					__UpperCAmelCase            =				field(default="toto"     ,     metadata={"help": "help message"}				)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				False
					__UpperCAmelCase            =				True
					__UpperCAmelCase            =				None




class 	lowerCamelCase_       (				__lowercase				):



					'''simple docstring'''







					__UpperCAmelCase            =				"titi"
					__UpperCAmelCase            =				"toto"




class 	lowerCamelCase_       (				__lowercase				):



					'''simple docstring'''







					__UpperCAmelCase            =				"titi"
					__UpperCAmelCase            =				"toto"
					__UpperCAmelCase            =				42




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				"toto"






					def A      (				self						)   ->			Optional[int]:







								'''simple docstring'''

								__lowercase 					=   BasicEnum(self.foo						)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				"toto"






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







								'''simple docstring'''

								__lowercase 					=   MixedTypeEnum(self.foo						)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				None
					__UpperCAmelCase            =				field(default=__lowercase     ,     metadata={"help": "help message"}				)
					__UpperCAmelCase            =				None
					__UpperCAmelCase            =				list_field(default=[]				)
					__UpperCAmelCase            =				list_field(default=[]				)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				list_field(default=[]				)
					__UpperCAmelCase            =				list_field(default=[1, 2, 3]				)
					__UpperCAmelCase            =				list_field(default=["Hallo", "Bonjour", "Hello"]				)
					__UpperCAmelCase            =				list_field(default=[0.1, 0.2, 0.3]				)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				field()
					__UpperCAmelCase            =				field()
					__UpperCAmelCase            =				field()






					def A      (				self						)   ->			Optional[Any]:







								'''simple docstring'''

								__lowercase 					=   BasicEnum(self.required_enum						)




@dataclass
class 	lowerCamelCase_       :



					'''simple docstring'''







					__UpperCAmelCase            =				42
					__UpperCAmelCase            =				field()
					__UpperCAmelCase            =				None
					__UpperCAmelCase            =				field(default="toto"     ,     metadata={"help": "help message"}				)
					__UpperCAmelCase            =				list_field(default=["Hallo", "Bonjour", "Hello"]				)


if is_python_no_less_than_3_10:
	@dataclass
	class 	lowerCamelCase_       :



						'''simple docstring'''







						__UpperCAmelCase            =				False
						__UpperCAmelCase            =				True
						__UpperCAmelCase            =				None




	@dataclass
	class 	lowerCamelCase_       :



						'''simple docstring'''







						__UpperCAmelCase            =				None
						__UpperCAmelCase            =				field(default=__lowercase     ,     metadata={"help": "help message"}				)
						__UpperCAmelCase            =				None
						__UpperCAmelCase            =				list_field(default=[]				)
						__UpperCAmelCase            =				list_field(default=[]				)





class 	lowerCamelCase_       (				unittest.TestCase				):



					'''simple docstring'''







					def A      (				self ,       snake_case_ ,       snake_case_						)   ->			List[Any]:







								'''simple docstring'''

								self.assertEqual(len(a._actions						) ,       len(b._actions						)						)
								for x, y in zip(a._actions ,       b._actions						):
											__lowercase 					=   {k: v for k, v in vars(_A						).items() if k != '''container'''}
											__lowercase 					=   {k: v for k, v in vars(_A						).items() if k != '''container'''}

											# Choices with mixed type have custom function as "type"
											# So we need to compare results directly for equality
											if xx.get('''choices''' ,       _A						) and yy.get('''choices''' ,       _A						):
														for expected_choice in yy["choices"] + xx["choices"]:
																	self.assertEqual(xx['''type'''](_A						) ,       yy['''type'''](_A						)						)
														del xx["type"], yy["type"]

											self.assertEqual(_A ,       _A						)






					def A      (				self						)   ->			Any:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo''' ,       type=_A ,       required=_A						)
								expected.add_argument('''--bar''' ,       type=_A ,       required=_A						)
								expected.add_argument('''--baz''' ,       type=_A ,       required=_A						)
								expected.add_argument('''--flag''' ,       type=_A ,       default=_A ,       const=_A ,       nargs='''?'''						)
								self.argparsersEqual(_A ,       _A						)

								__lowercase 					=   ['''--foo''', '''1''', '''--baz''', '''quux''', '''--bar''', '''0.5''']
								((__lowercase						)					, 						) 					=   parser.parse_args_into_dataclasses(_A ,       look_for_args_file=_A						)
								self.assertFalse(example.flag						)






					def A      (				self						)   ->			List[str]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo''' ,       default=4_2 ,       type=_A						)
								expected.add_argument('''--baz''' ,       default='''toto''' ,       type=_A ,       help='''help message'''						)
								self.argparsersEqual(_A ,       _A						)






					def A      (				self						)   ->			Any:







								'''simple docstring'''

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo''' ,       type=_A ,       default=_A ,       const=_A ,       nargs='''?'''						)
								expected.add_argument('''--baz''' ,       type=_A ,       default=_A ,       const=_A ,       nargs='''?'''						)
								# A boolean no_* argument always has to come after its "default: True" regular counter-part
								# and its default must be set to False
								expected.add_argument('''--no_baz''' ,       action='''store_false''' ,       default=_A ,       dest='''baz'''						)
								expected.add_argument('''--opt''' ,       type=_A ,       default=_A						)

								__lowercase 					=   [WithDefaultBoolExample]
								if is_python_no_less_than_3_10:
											dataclass_types.append(_A						)

								for dataclass_type in dataclass_types:
											__lowercase 					=   HfArgumentParser(_A						)
											self.argparsersEqual(_A ,       _A						)

											__lowercase 					=   parser.parse_args([]						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       baz=_A ,       opt=_A						)						)

											__lowercase 					=   parser.parse_args(['''--foo''', '''--no_baz''']						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       baz=_A ,       opt=_A						)						)

											__lowercase 					=   parser.parse_args(['''--foo''', '''--baz''']						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       baz=_A ,       opt=_A						)						)

											__lowercase 					=   parser.parse_args(['''--foo''', '''True''', '''--baz''', '''True''', '''--opt''', '''True''']						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       baz=_A ,       opt=_A						)						)

											__lowercase 					=   parser.parse_args(['''--foo''', '''False''', '''--baz''', '''False''', '''--opt''', '''False''']						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       baz=_A ,       opt=_A						)						)






					def A      (				self						)   ->			Optional[Any]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument(
								    '''--foo''' ,       default='''toto''' ,       choices=['''titi''', '''toto''', 4_2] ,       type=make_choice_type_function(['''titi''', '''toto''', 4_2]						) ,       )
								self.argparsersEqual(_A ,       _A						)

								__lowercase 					=   parser.parse_args([]						)
								self.assertEqual(args.foo ,       '''toto'''						)
								__lowercase 					=   parser.parse_args_into_dataclasses([]						)[0]
								self.assertEqual(enum_ex.foo ,       MixedTypeEnum.toto						)

								__lowercase 					=   parser.parse_args(['''--foo''', '''titi''']						)
								self.assertEqual(args.foo ,       '''titi'''						)
								__lowercase 					=   parser.parse_args_into_dataclasses(['''--foo''', '''titi''']						)[0]
								self.assertEqual(enum_ex.foo ,       MixedTypeEnum.titi						)

								__lowercase 					=   parser.parse_args(['''--foo''', '''42''']						)
								self.assertEqual(args.foo ,       4_2						)
								__lowercase 					=   parser.parse_args_into_dataclasses(['''--foo''', '''42''']						)[0]
								self.assertEqual(enum_ex.foo ,       MixedTypeEnum.fourtytwo						)






					def A      (				self						)   ->			Any:







								'''simple docstring'''

								@dataclass
								class 	lowerCamelCase_       :



													'''simple docstring'''







													__UpperCAmelCase            =				"toto"




								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument(
								    '''--foo''' ,       default='''toto''' ,       choices=('''titi''', '''toto''', 4_2) ,       type=make_choice_type_function(['''titi''', '''toto''', 4_2]						) ,       )
								self.argparsersEqual(_A ,       _A						)

								__lowercase 					=   parser.parse_args([]						)
								self.assertEqual(args.foo ,       '''toto'''						)

								__lowercase 					=   parser.parse_args(['''--foo''', '''titi''']						)
								self.assertEqual(args.foo ,       '''titi'''						)

								__lowercase 					=   parser.parse_args(['''--foo''', '''42''']						)
								self.assertEqual(args.foo ,       4_2						)






					def A      (				self						)   ->			int:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo_int''' ,       nargs='''+''' ,       default=[] ,       type=_A						)
								expected.add_argument('''--bar_int''' ,       nargs='''+''' ,       default=[1, 2, 3] ,       type=_A						)
								expected.add_argument('''--foo_str''' ,       nargs='''+''' ,       default=['''Hallo''', '''Bonjour''', '''Hello'''] ,       type=_A						)
								expected.add_argument('''--foo_float''' ,       nargs='''+''' ,       default=[0.1, 0.2, 0.3] ,       type=_A						)

								self.argparsersEqual(_A ,       _A						)

								__lowercase 					=   parser.parse_args([]						)
								self.assertEqual(
								    _A ,       Namespace(foo_int=[] ,       bar_int=[1, 2, 3] ,       foo_str=['''Hallo''', '''Bonjour''', '''Hello'''] ,       foo_float=[0.1, 0.2, 0.3]						) ,       )

								__lowercase 					=   parser.parse_args('''--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7'''.split()						)
								self.assertEqual(_A ,       Namespace(foo_int=[1] ,       bar_int=[2, 3] ,       foo_str=['''a''', '''b''', '''c'''] ,       foo_float=[0.1, 0.7]						)						)






					def A      (				self						)   ->			Tuple:







								'''simple docstring'''

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo''' ,       default=_A ,       type=_A						)
								expected.add_argument('''--bar''' ,       default=_A ,       type=_A ,       help='''help message'''						)
								expected.add_argument('''--baz''' ,       default=_A ,       type=_A						)
								expected.add_argument('''--ces''' ,       nargs='''+''' ,       default=[] ,       type=_A						)
								expected.add_argument('''--des''' ,       nargs='''+''' ,       default=[] ,       type=_A						)

								__lowercase 					=   [OptionalExample]
								if is_python_no_less_than_3_10:
											dataclass_types.append(_A						)

								for dataclass_type in dataclass_types:
											__lowercase 					=   HfArgumentParser(_A						)

											self.argparsersEqual(_A ,       _A						)

											__lowercase 					=   parser.parse_args([]						)
											self.assertEqual(_A ,       Namespace(foo=_A ,       bar=_A ,       baz=_A ,       ces=[] ,       des=[]						)						)

											__lowercase 					=   parser.parse_args('''--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'''.split()						)
											self.assertEqual(_A ,       Namespace(foo=1_2 ,       bar=3.1_4 ,       baz='''42''' ,       ces=['''a''', '''b''', '''c'''] ,       des=[1, 2, 3]						)						)






					def A      (				self						)   ->			Any:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--required_list''' ,       nargs='''+''' ,       type=_A ,       required=_A						)
								expected.add_argument('''--required_str''' ,       type=_A ,       required=_A						)
								expected.add_argument(
								    '''--required_enum''' ,       type=make_choice_type_function(['''titi''', '''toto''']						) ,       choices=['''titi''', '''toto'''] ,       required=_A ,       )
								self.argparsersEqual(_A ,       _A						)






					def A      (				self						)   ->			List[str]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   argparse.ArgumentParser()
								expected.add_argument('''--foo''' ,       type=_A ,       required=_A						)
								expected.add_argument(
								    '''--required_enum''' ,       type=make_choice_type_function(['''titi''', '''toto''']						) ,       choices=['''titi''', '''toto'''] ,       required=_A ,       )
								expected.add_argument('''--opt''' ,       type=_A ,       default=_A						)
								expected.add_argument('''--baz''' ,       default='''toto''' ,       type=_A ,       help='''help message'''						)
								expected.add_argument('''--foo_str''' ,       nargs='''+''' ,       default=['''Hallo''', '''Bonjour''', '''Hello'''] ,       type=_A						)
								self.argparsersEqual(_A ,       _A						)






					def A      (				self						)   ->			List[Any]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   {
								    '''foo''': 1_2,
								    '''bar''': 3.1_4,
								    '''baz''': '''42''',
								    '''flag''': True,
								}

								__lowercase 					=   parser.parse_dict(_A						)[0]
								__lowercase 					=   BasicExample(**_A						)
								self.assertEqual(_A ,       _A						)






					def A      (				self						)   ->			List[Any]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   {
								    '''foo''': 1_2,
								    '''bar''': 3.1_4,
								    '''baz''': '''42''',
								    '''flag''': True,
								    '''extra''': 4_2,
								}

								self.assertRaises(_A ,       parser.parse_dict ,       _A ,       allow_extra_keys=_A						)






					def A      (				self						)   ->			Optional[int]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   {
								    '''foo''': 1_2,
								    '''bar''': 3.1_4,
								    '''baz''': '''42''',
								    '''flag''': True,
								}
								with tempfile.TemporaryDirectory() as tmp_dir:
											__lowercase 					=   os.path.join(_A ,       '''temp_json'''						)
											os.mkdir(_A						)
											with open(temp_local_path + '''.json''' ,       '''w+'''						) as f:
														json.dump(_A ,       _A						)
											__lowercase 					=   parser.parse_yaml_file(Path(temp_local_path + '''.json'''						)						)[0]

								__lowercase 					=   BasicExample(**_A						)
								self.assertEqual(_A ,       _A						)






					def A      (				self						)   ->			Tuple:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)

								__lowercase 					=   {
								    '''foo''': 1_2,
								    '''bar''': 3.1_4,
								    '''baz''': '''42''',
								    '''flag''': True,
								}
								with tempfile.TemporaryDirectory() as tmp_dir:
											__lowercase 					=   os.path.join(_A ,       '''temp_yaml'''						)
											os.mkdir(_A						)
											with open(temp_local_path + '''.yaml''' ,       '''w+'''						) as f:
														yaml.dump(_A ,       _A						)
											__lowercase 					=   parser.parse_yaml_file(Path(temp_local_path + '''.yaml'''						)						)[0]
								__lowercase 					=   BasicExample(**_A						)
								self.assertEqual(_A ,       _A						)






					def A      (				self						)   ->			Optional[Any]:







								'''simple docstring'''

								__lowercase 					=   HfArgumentParser(_A						)
								self.assertIsNotNone(_A						)



import copy
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union


if TYPE_CHECKING:
	from ...processing_utils import ProcessorMixin
	from ...utils import TensorType

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a : Union[str, Any]		=				logging.get_logger(__name__)

a : Any		=				{
    '''google/owlvit-base-patch32''': '''https://huggingface.co/google/owlvit-base-patch32/resolve/main/config.json''',
    '''google/owlvit-base-patch16''': '''https://huggingface.co/google/owlvit-base-patch16/resolve/main/config.json''',
    '''google/owlvit-large-patch14''': '''https://huggingface.co/google/owlvit-large-patch14/resolve/main/config.json''',
}
class 	lowerCamelCase_       (				lowerCAmelCase__				):



					'''simple docstring'''







					__UpperCAmelCase            =				"owlvit_text_model"






					def __init__(				self ,       snake_case_=4_9_4_0_8 ,       snake_case_=5_1_2 ,       snake_case_=2_0_4_8 ,       snake_case_=1_2 ,       snake_case_=8 ,       snake_case_=1_6 ,       snake_case_="quick_gelu" ,       snake_case_=1e-5 ,       snake_case_=0.0 ,       snake_case_=0.0_2 ,       snake_case_=1.0 ,       snake_case_=0 ,       snake_case_=4_9_4_0_6 ,       snake_case_=4_9_4_0_7 ,       **snake_case_ ,       )   ->			int:







								'''simple docstring'''

								super().__init__(pad_token_id=snake_case_ ,       bos_token_id=snake_case_ ,       eos_token_id=snake_case_ ,       **snake_case_						)

								__lowercase 					=   vocab_size
								__lowercase 					=   hidden_size
								__lowercase 					=   intermediate_size
								__lowercase 					=   num_hidden_layers
								__lowercase 					=   num_attention_heads
								__lowercase 					=   max_position_embeddings
								__lowercase 					=   hidden_act
								__lowercase 					=   layer_norm_eps
								__lowercase 					=   attention_dropout
								__lowercase 					=   initializer_range
								__lowercase 					=   initializer_factor






					@classmethod
					def A      (				cls ,       snake_case_ ,       **snake_case_						)   ->			"PretrainedConfig":







								'''simple docstring'''

								cls._set_token_in_kwargs(snake_case_						)

								__lowercase					, __lowercase 					=   cls.get_config_dict(snake_case_ ,       **snake_case_						)

								# get the text config dict if we are loading from OwlViTConfig
								if config_dict.get('''model_type'''						) == "owlvit":
											__lowercase 					=   config_dict['''text_config''']

								if "model_type" in config_dict and hasattr(cls ,       '''model_type'''						) and config_dict["model_type"] != cls.model_type:
											logger.warning(
											    F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
											    F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'						)

								return cls.from_dict(snake_case_ ,       **snake_case_						)




class 	lowerCamelCase_       (				lowerCAmelCase__				):



					'''simple docstring'''







					__UpperCAmelCase            =				"owlvit_vision_model"






					def __init__(				self ,       snake_case_=7_6_8 ,       snake_case_=3_0_7_2 ,       snake_case_=1_2 ,       snake_case_=1_2 ,       snake_case_=3 ,       snake_case_=7_6_8 ,       snake_case_=3_2 ,       snake_case_="quick_gelu" ,       snake_case_=1e-5 ,       snake_case_=0.0 ,       snake_case_=0.0_2 ,       snake_case_=1.0 ,       **snake_case_ ,       )   ->			Any:







								'''simple docstring'''

								super().__init__(**snake_case_						)

								__lowercase 					=   hidden_size
								__lowercase 					=   intermediate_size
								__lowercase 					=   num_hidden_layers
								__lowercase 					=   num_attention_heads
								__lowercase 					=   num_channels
								__lowercase 					=   image_size
								__lowercase 					=   patch_size
								__lowercase 					=   hidden_act
								__lowercase 					=   layer_norm_eps
								__lowercase 					=   attention_dropout
								__lowercase 					=   initializer_range
								__lowercase 					=   initializer_factor






					@classmethod
					def A      (				cls ,       snake_case_ ,       **snake_case_						)   ->			"PretrainedConfig":







								'''simple docstring'''

								cls._set_token_in_kwargs(snake_case_						)

								__lowercase					, __lowercase 					=   cls.get_config_dict(snake_case_ ,       **snake_case_						)

								# get the vision config dict if we are loading from OwlViTConfig
								if config_dict.get('''model_type'''						) == "owlvit":
											__lowercase 					=   config_dict['''vision_config''']

								if "model_type" in config_dict and hasattr(cls ,       '''model_type'''						) and config_dict["model_type"] != cls.model_type:
											logger.warning(
											    F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
											    F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'						)

								return cls.from_dict(snake_case_ ,       **snake_case_						)




class 	lowerCamelCase_       (				lowerCAmelCase__				):



					'''simple docstring'''







					__UpperCAmelCase            =				"owlvit"
					__UpperCAmelCase            =				True






					def __init__(				self ,       snake_case_=None ,       snake_case_=None ,       snake_case_=5_1_2 ,       snake_case_=2.6_5_9_2 ,       snake_case_=True ,       **snake_case_ ,       )   ->			Optional[Any]:







								'''simple docstring'''

								super().__init__(**snake_case_						)

								if text_config is None:
											__lowercase 					=   {}
											logger.info('''text_config is None. Initializing the OwlViTTextConfig with default values.'''						)

								if vision_config is None:
											__lowercase 					=   {}
											logger.info('''vision_config is None. initializing the OwlViTVisionConfig with default values.'''						)

								__lowercase 					=   OwlViTTextConfig(**snake_case_						)
								__lowercase 					=   OwlViTVisionConfig(**snake_case_						)

								__lowercase 					=   projection_dim
								__lowercase 					=   logit_scale_init_value
								__lowercase 					=   return_dict
								__lowercase 					=   1.0






					@classmethod
					def A      (				cls ,       snake_case_ ,       **snake_case_						)   ->			"PretrainedConfig":







								'''simple docstring'''

								cls._set_token_in_kwargs(snake_case_						)

								__lowercase					, __lowercase 					=   cls.get_config_dict(snake_case_ ,       **snake_case_						)

								if "model_type" in config_dict and hasattr(cls ,       '''model_type'''						) and config_dict["model_type"] != cls.model_type:
											logger.warning(
											    F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
											    F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'						)

								return cls.from_dict(snake_case_ ,       **snake_case_						)






					@classmethod
					def A      (				cls ,       snake_case_ ,       snake_case_ ,       **snake_case_						)   ->			int:







								'''simple docstring'''

								__lowercase 					=   {}
								__lowercase 					=   text_config
								__lowercase 					=   vision_config

								return cls.from_dict(snake_case_ ,       **snake_case_						)






					def A      (				self						)   ->			Any:







								'''simple docstring'''

								__lowercase 					=   copy.deepcopy(self.__dict__						)
								__lowercase 					=   self.text_config.to_dict()
								__lowercase 					=   self.vision_config.to_dict()
								__lowercase 					=   self.__class__.model_type
								return output




class 	lowerCamelCase_       (				lowerCAmelCase__				):



					'''simple docstring'''







					@property
					def A      (				self						)   ->			Mapping[str, Mapping[int, str]]:







								'''simple docstring'''

								return OrderedDict(
								    [
								        ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
								        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
								        ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
								    ]						)






					@property
					def A      (				self						)   ->			Mapping[str, Mapping[int, str]]:







								'''simple docstring'''

								return OrderedDict(
								    [
								        ('''logits_per_image''', {0: '''batch'''}),
								        ('''logits_per_text''', {0: '''batch'''}),
								        ('''text_embeds''', {0: '''batch'''}),
								        ('''image_embeds''', {0: '''batch'''}),
								    ]						)






					@property
					def A      (				self						)   ->			float:







								'''simple docstring'''

								return 1e-4






					def A      (				self ,       snake_case_ ,       snake_case_ = -1 ,       snake_case_ = -1 ,       snake_case_ = None ,       )   ->			Mapping[str, Any]:







								'''simple docstring'''

								__lowercase 					=   super().generate_dummy_inputs(
								    processor.tokenizer ,       batch_size=snake_case_ ,       seq_length=snake_case_ ,       framework=snake_case_						)
								__lowercase 					=   super().generate_dummy_inputs(
								    processor.image_processor ,       batch_size=snake_case_ ,       framework=snake_case_						)
								return {**text_input_dict, **image_input_dict}






					@property
					def A      (				self						)   ->			int:







								'''simple docstring'''

								return 1_4


