





import copy
from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


if TYPE_CHECKING:
							from ... import PreTrainedTokenizerBase, TensorType

UpperCAmelCase_							=				logging.get_logger(__name__)
class     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		__a       :       List[Any]       =	"""vision-encoder-decoder"""
		__a       :       str       =	True






		def __init__(							self,   **snake_case__  )       -> Optional[int]:






									"""simple docstring"""
									super().__init__(**snake_case__  )
									if "encoder" not in kwargs or "decoder" not in kwargs:
																raise ValueError(
																    f"""A configuraton of type {self.model_type} cannot be instantiated because """
																    f"""not both `encoder` and `decoder` sub-configurations are passed, but only {kwargs}"""  )

									lowercase_	:   Dict  				=     kwargs.pop("""encoder"""  )
									lowercase_	:   Tuple  				=     encoder_config.pop("""model_type"""  )
									lowercase_	:   List[Any]  				=     kwargs.pop("""decoder"""  )
									lowercase_	:   Union[str, Any]  				=     decoder_config.pop("""model_type"""  )

									lowercase_	:   Optional[int]  				=     AutoConfig.for_model(snake_case__,   **snake_case__  )
									lowercase_	:   Any  				=     AutoConfig.for_model(snake_case__,   **snake_case__  )
									lowercase_	:   Optional[Any]  				=     True






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






									"""simple docstring"""
									logger.info("""Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"""  )
									lowercase_	:   List[str]  				=     True
									lowercase_	:   Optional[int]  				=     True

									return cls(encoder=encoder_config.to_dict(),   decoder=decoder_config.to_dict(),   **snake_case__  )






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






									"""simple docstring"""
									lowercase_	:   Union[str, Any]  				=     copy.deepcopy(self.__dict__  )
									lowercase_	:   Optional[int]  				=     self.encoder.to_dict()
									lowercase_	:   Optional[int]  				=     self.decoder.to_dict()
									lowercase_	:   str  				=     self.__class__.model_type
									return output




class     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		__a       :       Optional[Any]       =	version.parse("""1.11"""				)






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






									"""simple docstring"""
									return OrderedDict(
									    [
									        ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
									    ]  )






		@property
		def 						snake_case__				(							self  )       -> float:






									"""simple docstring"""
									return 1E-4






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






									"""simple docstring"""
									return OrderedDict({"""last_hidden_state""": {0: """batch""", 1: """encoder_sequence"""}}  )




class     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






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






									"""simple docstring"""
									lowercase_	:   List[str]  				=     OrderedDict()
									lowercase_	:   Dict  				=     {0: """batch""", 1: """past_decoder_sequence + sequence"""}
									lowercase_	:   Optional[Any]  				=     {0: """batch""", 1: """past_decoder_sequence + sequence"""}
									lowercase_	:   int  				=     {0: """batch""", 1: """encoder_sequence"""}

									return common_inputs






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






									"""simple docstring"""
									import torch

									lowercase_	:   Dict  				=     OrderedDict()

									lowercase_	:   List[Any]  				=     super().generate_dummy_inputs(
									    snake_case__,   batch_size=snake_case__,   seq_length=snake_case__,   is_pair=snake_case__,   framework=snake_case__  )

									lowercase_				,		lowercase_	:   str  				=     dummy_input["""input_ids"""].shape
									lowercase_	:   Tuple  				=     (batch, encoder_sequence, self._config.encoder_hidden_size)
									lowercase_	:   Dict  				=     dummy_input.pop("""input_ids"""  )
									lowercase_	:   Any  				=     dummy_input.pop("""attention_mask"""  )
									lowercase_	:   Union[str, Any]  				=     torch.zeros(snake_case__  )

									return common_inputs




class     UpperCamelCase__					(     lowerCamelCase__				):






		'''simple docstring'''






		@property
		def 						snake_case__				(							self  )       -> None:






									"""simple docstring"""
									pass






		def 						snake_case__				(							self,   snake_case__  )       -> OnnxConfig:






									"""simple docstring"""
									return VisionEncoderDecoderEncoderOnnxConfig(snake_case__  )






		def 						snake_case__				(							self,   snake_case__,   snake_case__,   snake_case__ = "default"  )       -> OnnxConfig:






									"""simple docstring"""
									lowercase_	:   List[Any]  				=     encoder_config.hidden_size
									return VisionEncoderDecoderDecoderOnnxConfig(snake_case__,   snake_case__  )






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)}''')