


'''simple docstring'''

from typing import TYPE_CHECKING

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


a_						:       Union[str, Any]      			=				{
    """configuration_llama""": ["""LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LlamaConfig"""],
}

try:
     if not is_sentencepiece_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       str      			=				["""LlamaTokenizer"""]

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       List[str]      			=				["""LlamaTokenizerFast"""]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:       Dict      			=				[
         """LlamaForCausalLM""",
         """LlamaModel""",
         """LlamaPreTrainedModel""",
         """LlamaForSequenceClassification""",
     ]


if TYPE_CHECKING:
     from .configuration_llama import LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP, LlamaConfig

     try:
          if not is_sentencepiece_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_llama import LlamaTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_llama_fast import LlamaTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_llama import LlamaForCausalLM, LlamaForSequenceClassification, LlamaModel, LlamaPreTrainedModel


else:
     import sys

     a_						:       List[str]      			=				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)







'''simple docstring'''

from __future__ import annotations





def __snake_case      (   UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int	):
 if b == 0:
  return (1, 0)
 ((lowerCamelCase_)				,(lowerCamelCase_))  				=						extended_euclid(UpperCAmelCase_      ,       a % b	)
 lowerCamelCase_  				=						a // b
 return (y, x - k * y)





def __snake_case      (   UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int	):
 ((lowerCamelCase_)				,(lowerCamelCase_))  				=						extended_euclid(UpperCAmelCase_      ,       UpperCAmelCase_	)
 lowerCamelCase_  				=						na * na
 lowerCamelCase_  				=						ra * x * na + ra * y * na
 return (n % m + m) % m





def __snake_case      (   UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int	):
 ((lowerCamelCase_)				,(lowerCamelCase_))  				=						extended_euclid(UpperCAmelCase_      ,       UpperCAmelCase_	)
 if b < 0:
  lowerCamelCase_  				=						(b % n + n) % n
 return b





def __snake_case      (   UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int      ,       UpperCAmelCase_		:		int	):
 lowerCamelCase_				,lowerCamelCase_  				=						invert_modulo(UpperCAmelCase_      ,       UpperCAmelCase_	), invert_modulo(UpperCAmelCase_      ,       UpperCAmelCase_	)
 lowerCamelCase_  				=						na * na
 lowerCamelCase_  				=						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)



