






from __future__ import annotations



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int			,				__lowercase   :			int    )						->      tuple[int, int]:





    """simple docstring"""

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



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int			,				__lowercase   :			int			,				__lowercase   :			int			,				__lowercase   :			int    )						->      int:





    """simple docstring"""

    ((__A)    ,	(__A))         =	extended_euclid(__lowercase			,				__lowercase    )
    __A         =	na * na
    __A         =	ra * x * na + ra * y * na
    return (n % m + m) % m



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int			,				__lowercase   :			int    )						->      int:





    """simple docstring"""

    ((__A)    ,	(__A))         =	extended_euclid(__lowercase			,				__lowercase    )
    if b < 0:
        __A         =	(b % n + n) % n
    return b



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int			,				__lowercase   :			int			,				__lowercase   :			int			,				__lowercase   :			int    )						->      int:





    """simple docstring"""

    __A    ,	__A         =	invert_modulo(__lowercase			,				__lowercase    ), invert_modulo(__lowercase			,				__lowercase    )
    __A         =	na * na
    __A         =	ra * x * na + ra * y * na
    return (n % m + m) % m


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

  testmod(name="chinese_remainder_theorem", verbose=True)
  testmod(name="chinese_remainder_theorem2", verbose=True)
  testmod(name="invert_modulo", verbose=True)
  testmod(name="extended_euclid", verbose=True)












from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
  if not (is_transformers_available() and is_torch_available()):
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  from ...utils.dummy_torch_and_transformers_objects import (
      ImageTextPipelineOutput,
      UniDiffuserPipeline,
  )
else:
  from .modeling_text_decoder import UniDiffuserTextDecoder
  from .modeling_uvit import UniDiffuserModel, UTransformeraDModel
  from .pipeline_unidiffuser import ImageTextPipelineOutput, UniDiffuserPipeline




