





'''simple docstring'''


from .hash_table import HashTable
from .number_theory.prime_numbers import is_prime, next_prime


class 		UpperCamelCase__     (       a_							):
      '''simple docstring'''






      def __init__(     self     , *SCREAMING_SNAKE_CASE     , **SCREAMING_SNAKE_CASE )				->  List[Any]:
        super().__init__(*snake_case__     , **snake_case__ )




      def 	snake_case  (     self     , SCREAMING_SNAKE_CASE     , SCREAMING_SNAKE_CASE )				->  str:
        __lowerCAmelCase		:    Union[str, Any]			     =  (
            next_prime(value % self.size_table )
            if not is_prime(value % self.size_table )
            else value % self.size_table
        )  # gt = bigger than
        return next_prime_gt - (data % next_prime_gt)




      def 	snake_case  (     self     , SCREAMING_SNAKE_CASE     , SCREAMING_SNAKE_CASE     , SCREAMING_SNAKE_CASE )				->  int:
        return (increment * self.__hash_function_a(snake_case__     , snake_case__ )) % self.size_table







      def 	snake_case  (     self     , SCREAMING_SNAKE_CASE     , SCREAMING_SNAKE_CASE=None )				->  Any:
        __lowerCAmelCase		:    str			     =  1
        __lowerCAmelCase		:    Union[str, Any]			     =  self.hash_function(snake_case__ )

        while self.values[new_key] is not None and self.values[new_key] != key:
          __lowerCAmelCase		:    Union[str, Any]			     =  (
              self.__hash_double_function(snake_case__     , snake_case__     , snake_case__ )
              if self.balanced_factor() >= self.lim_charge
              else None
          )
          if new_key is None:
            break
          else:
            i += 1

        return new_key










import copy

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


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


class    _lowercase (a_   ):
				'''simple docstring'''







				lowercase__     =    """speech-encoder-decoder"""
				lowercase__     =    True

				def __init__(			self  ,			**snake_case__     ):

									'''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 not both `encoder` and"""
														    F""" `decoder` sub-configurations are passed, but only {kwargs}"""     )

									UpperCamelCase_			= kwargs.pop("encoder"     )
									UpperCamelCase_			= encoder_config.pop("model_type"     )
									UpperCamelCase_			= kwargs.pop("decoder"     )
									UpperCamelCase_			= decoder_config.pop("model_type"     )

									UpperCamelCase_			= AutoConfig.for_model(snake_case__  ,			**snake_case__     )
									UpperCamelCase_			= AutoConfig.for_model(snake_case__  ,			**snake_case__     )
									UpperCamelCase_			= True

				@classmethod
				def    _lowerCamelCase       (			cls  ,			snake_case__  ,			snake_case__  ,			**snake_case__     ):

									'''simple docstring'''


									logger.info("Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"     )
									UpperCamelCase_			= True
									UpperCamelCase_			= True

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

				def    _lowerCamelCase       (			self     ):

									'''simple docstring'''


									UpperCamelCase_			= copy.deepcopy(self.__dict__     )
									UpperCamelCase_			= self.encoder.to_dict()
									UpperCamelCase_			= self.decoder.to_dict()
									UpperCamelCase_			= self.__class__.model_type
									return output
