





import copy
import os
from typing import Union

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


UpperCAmelCase_							=				logging.get_logger(__name__)

UpperCAmelCase_							=				{
    """BridgeTower/bridgetower-base""": """https://huggingface.co/BridgeTower/bridgetower-base/blob/main/config.json""",
    """BridgeTower/bridgetower-base-itm-mlm""": (
        """https://huggingface.co/BridgeTower/bridgetower-base-itm-mlm/blob/main/config.json"""
    ),
}
class     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		__a       :       Optional[int]       =	"""bridgetower_vision_model"""






		def __init__(							self,   snake_case__=7_68,   snake_case__=12,   snake_case__=3,   snake_case__=16,   snake_case__=2_88,   snake_case__=1,   snake_case__=1E-05,   snake_case__=False,   snake_case__=True,   snake_case__=False,   **snake_case__,   )       -> Any:






									"""simple docstring"""
									super().__init__(**snake_case__  )
									lowercase_	:   Union[str, Any]  				=     hidden_size
									lowercase_	:   Optional[int]  				=     num_hidden_layers
									lowercase_	:   Tuple  				=     num_channels
									lowercase_	:   List[str]  				=     patch_size
									lowercase_	:   Dict  				=     image_size
									lowercase_	:   int  				=     initializer_factor
									lowercase_	:   List[Any]  				=     layer_norm_eps
									lowercase_	:   Dict  				=     stop_gradient
									lowercase_	:   Tuple  				=     share_layernorm
									lowercase_	:   Optional[Any]  				=     remove_last_layer






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






									"""simple docstring"""
									lowercase_				,		lowercase_	:   Optional[Any]  				=     cls.get_config_dict(snake_case__,   **snake_case__  )

									if config_dict.get("""model_type"""  ) == "bridgetower":
																lowercase_	:   Dict  				=     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     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		__a       :       Any       =	"""bridgetower_text_model"""






		def __init__(							self,   snake_case__=5_02_65,   snake_case__=7_68,   snake_case__=12,   snake_case__=12,   snake_case__=1,   snake_case__=30_72,   snake_case__="gelu",   snake_case__=0.1,   snake_case__=0.1,   snake_case__=5_14,   snake_case__=1,   snake_case__=1E-05,   snake_case__=1,   snake_case__=0,   snake_case__=2,   snake_case__="absolute",   snake_case__=True,   **snake_case__,   )       -> List[str]:






									"""simple docstring"""
									super().__init__(**snake_case__  )

									lowercase_	:   Any  				=     vocab_size
									lowercase_	:   List[Any]  				=     hidden_size
									lowercase_	:   str  				=     num_hidden_layers
									lowercase_	:   Any  				=     num_attention_heads
									lowercase_	:   str  				=     hidden_act
									lowercase_	:   Union[str, Any]  				=     initializer_factor
									lowercase_	:   Tuple  				=     intermediate_size
									lowercase_	:   Optional[Any]  				=     hidden_dropout_prob
									lowercase_	:   Optional[int]  				=     attention_probs_dropout_prob
									lowercase_	:   Dict  				=     max_position_embeddings
									lowercase_	:   List[Any]  				=     type_vocab_size
									lowercase_	:   List[Any]  				=     layer_norm_eps
									lowercase_	:   Dict  				=     position_embedding_type
									lowercase_	:   List[Any]  				=     use_cache
									lowercase_	:   Optional[int]  				=     pad_token_id
									lowercase_	:   str  				=     bos_token_id
									lowercase_	:   List[Any]  				=     eos_token_id






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






									"""simple docstring"""
									lowercase_				,		lowercase_	:   Optional[int]  				=     cls.get_config_dict(snake_case__,   **snake_case__  )

									if config_dict.get("""model_type"""  ) == "bridgetower":
																lowercase_	:   List[str]  				=     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     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		__a       :       Tuple       =	"""bridgetower"""






		def __init__(							self,   snake_case__=True,   snake_case__="gelu",   snake_case__=7_68,   snake_case__=1,   snake_case__=1E-05,   snake_case__=False,   snake_case__="add",   snake_case__=12,   snake_case__=6,   snake_case__=False,   snake_case__=False,   snake_case__=None,   snake_case__=None,   **snake_case__,   )       -> Tuple:






									"""simple docstring"""
									# TODO: remove this once the Hub files are updated.
									lowercase_	:   int  				=     kwargs.pop("""text_config_dict""",   snake_case__  )
									lowercase_	:   Dict  				=     kwargs.pop("""vision_config_dict""",   snake_case__  )

									super().__init__(**snake_case__  )
									lowercase_	:   List[str]  				=     share_cross_modal_transformer_layers
									lowercase_	:   Union[str, Any]  				=     hidden_act
									lowercase_	:   Dict  				=     hidden_size
									lowercase_	:   Dict  				=     initializer_factor
									lowercase_	:   Tuple  				=     layer_norm_eps
									lowercase_	:   Union[str, Any]  				=     share_link_tower_layers
									lowercase_	:   List[Any]  				=     link_tower_type
									lowercase_	:   Dict  				=     num_attention_heads
									lowercase_	:   List[Any]  				=     num_hidden_layers
									lowercase_	:   Union[str, Any]  				=     tie_word_embeddings
									lowercase_	:   int  				=     init_layernorm_from_vision_encoder

									if text_config is None:
																lowercase_	:   Optional[int]  				=     {}
																logger.info("""`text_config` is `None`. Initializing the `BridgeTowerTextConfig` with default values."""  )

									if vision_config is None:
																lowercase_	:   Tuple  				=     {}
																logger.info("""`vision_config` is `None`. Initializing the `BridgeTowerVisionConfig` with default values."""  )

									lowercase_	:   Optional[Any]  				=     BridgeTowerTextConfig(**snake_case__  )
									lowercase_	:   Any  				=     BridgeTowerVisionConfig(**snake_case__  )






		@classmethod
		def 						snake_case__				(							cls,   snake_case__,   snake_case__,   **snake_case__  )       -> Any:






									"""simple docstring"""
									return cls(text_config=text_config.to_dict(),   vision_config=vision_config.to_dict(),   **snake_case__  )






		def 						snake_case__				(							self  )       -> Tuple:






									"""simple docstring"""
									lowercase_	:   str  				=     copy.deepcopy(self.__dict__  )
									lowercase_	:   str  				=     self.text_config.to_dict()
									lowercase_	:   Optional[Any]  				=     self.vision_config.to_dict()
									lowercase_	:   Dict  				=     self.__class__.model_type
									return output






import qiskit





def  __magic_name__  (				lowercase				,       lowercase				)				-> qiskit.result.counts.Counts:

							"""simple docstring"""



							lowercase_	:   Dict  				=     qiskit.Aer.get_backend("""aer_simulator"""				)

							# Create a Quantum Circuit acting on the q register
							lowercase_	:   str  				=     qiskit.QuantumCircuit(lowercase				,       lowercase				)

							# Map the quantum measurement to the classical bits
							circuit.measure([0]				,       [0]				)

							# Execute the circuit on the simulator
							lowercase_	:   List[Any]  				=     qiskit.execute(lowercase				,       lowercase				,       shots=1000				)

							# Return the histogram data of the results of the experiment.
							return job.result().get_counts(lowercase				)


if __name__ == "__main__":
							print(F'''Total count for various states are: {single_qubit_measure(1, 1)}''')