





from __future__ import annotations


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  assert n > 1 and a > 0 and greatest_common_divisor(__lowercase     ,							__lowercase) == 1
  ((__lowerCAmelCase)	,						(__lowerCAmelCase)	,						(__lowerCAmelCase))			=				extended_gcd(__lowercase     ,							__lowercase)  # Implemented below
  __lowerCAmelCase			=				(b * s) % n
  return x


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  ((__lowerCAmelCase)	,						(__lowerCAmelCase))			=				extended_euclid(__lowercase     ,							__lowercase)  # Implemented below
  if b < 0:
    __lowerCAmelCase			=				(b % n + n) % n
  return b


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  __lowerCAmelCase			=				invert_modulo(__lowercase     ,							__lowercase)
  __lowerCAmelCase			=				(b * s) % n
  return x


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  assert a >= 0 and b >= 0

  if b == 0:
    __lowerCAmelCase	,						__lowerCAmelCase	,						__lowerCAmelCase			=				a, 1, 0
  else:
    ((__lowerCAmelCase)	,						(__lowerCAmelCase)	,						(__lowerCAmelCase))			=				extended_gcd(__lowercase     ,							a % b)
    __lowerCAmelCase			=				q
    __lowerCAmelCase			=				p - q * (a // b)

  assert a % d == 0 and b % d == 0
  assert d == a * x + b * y

  return (d, x, y)


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  if b == 0:
    return (1, 0)
  ((__lowerCAmelCase)	,						(__lowerCAmelCase))			=				extended_euclid(__lowercase     ,							a % b)
  __lowerCAmelCase			=				a // b
  return (y, x - k * y)


def 					__SCREAMING_SNAKE_CASE  (							__lowercase:		int     ,							__lowercase:		int):



  '''simple docstring'''






  if a < b:
    __lowerCAmelCase	,						__lowerCAmelCase			=				b, a

  while a % b != 0:
    __lowerCAmelCase	,						__lowerCAmelCase			=				b, a % b

  return b


if __name__ == "__main__":
      from doctest import testmod

      testmod(name="""modular_division""", verbose=True)
      testmod(name="""modular_division2""", verbose=True)
      testmod(name="""invert_modulo""", verbose=True)
      testmod(name="""extended_gcd""", verbose=True)
      testmod(name="""extended_euclid""", verbose=True)
      testmod(name="""greatest_common_divisor""", verbose=True)







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


__lowercase													=			{
    """configuration_speech_to_text_2""": ["""SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Speech2Text2Config"""],
    """processing_speech_to_text_2""": ["""Speech2Text2Processor"""],
    """tokenization_speech_to_text_2""": ["""Speech2Text2Tokenizer"""],
}


try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowercase													=			[
          """SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """Speech2Text2ForCausalLM""",
          """Speech2Text2PreTrainedModel""",
      ]


if TYPE_CHECKING:
      from .configuration_speech_to_text_a import SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextaConfig
      from .processing_speech_to_text_a import SpeechaTextaProcessor
      from .tokenization_speech_to_text_a import SpeechaTextaTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_speech_to_text_a import (
                SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST,
                SpeechaTextaForCausalLM,
                SpeechaTextaPreTrainedModel,
            )

else:
      import sys

      __lowercase													=			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
