from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase				 =   logging.get_logger(__name__)

UpperCAmelCase				 =   {
    """facebook/convnext-tiny-224""": """https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json""",
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}






class 				_SCREAMING_SNAKE_CASE( snake_case__							,   snake_case__						):
   UpperCamelCase_					:    Optional[int]			      = 'convnext'
   def __init__(     self				,  lowerCAmelCase_=3				,  lowerCAmelCase_=4				,  lowerCAmelCase_=4				,  lowerCAmelCase_=None				,  lowerCAmelCase_=None				,  lowerCAmelCase_="gelu"				,  lowerCAmelCase_=0.02				,  lowerCAmelCase_=1e-12				,  lowerCAmelCase_=1e-6				,  lowerCAmelCase_=0.0				,  lowerCAmelCase_=2_24				,  lowerCAmelCase_=None				,  lowerCAmelCase_=None				,  **lowerCAmelCase_				,  )						->Dict:
        super().__init__(**lowerCAmelCase_     )

        a	:     Dict						      =    num_channels
        a	:     List[Any]						      =    patch_size
        a	:     Union[str, Any]						      =    num_stages
        a	:     Union[str, Any]						      =    [96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
        a	:     Optional[int]						      =    [3, 3, 9, 3] if depths is None else depths
        a	:     Optional[Any]						      =    hidden_act
        a	:     Dict						      =    initializer_range
        a	:     List[Any]						      =    layer_norm_eps
        a	:     str						      =    layer_scale_init_value
        a	:     int						      =    drop_path_rate
        a	:     Optional[Any]						      =    image_size
        a	:     List[str]						      =    ['''stem'''] + [F"""stage{idx}""" for idx in range(1				,  len(self.depths     ) + 1     )]
        a      ,				a	:     Optional[Any]						      =    get_aligned_output_features_output_indices(
            out_features=lowerCAmelCase_				,  out_indices=lowerCAmelCase_				,  stage_names=self.stage_names     )






class 				_SCREAMING_SNAKE_CASE( snake_case__						):
   UpperCamelCase_					:    int			      = version.parse('1.11'						)
   @property
   def _lowercase(     self     )						->Mapping[str, Mapping[int, str]]:
        return OrderedDict(
            [
                ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
            ]     )


   @property
   def _lowercase(     self     )						->float:
        return 1e-5
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


UpperCAmelCase				 =   {
    """configuration_gptsan_japanese""": ["""GPTSAN_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTSanJapaneseConfig"""],
    """tokenization_gptsan_japanese""": ["""GPTSanJapaneseTokenizer"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """GPTSAN_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """GPTSanJapaneseForConditionalGeneration""",
      """GPTSanJapaneseModel""",
      """GPTSanJapanesePreTrainedModel""",
  ]
  UpperCAmelCase				 =   [
      """GPTSanJapaneseTokenizer""",
  ]


if TYPE_CHECKING:
  from .configuration_gptsan_japanese import GPTSAN_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTSanJapaneseConfig
  from .tokenization_gptsan_japanese import GPTSanJapaneseTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_gptsan_japanese import (
        GPTSAN_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
        GPTSanJapaneseForConditionalGeneration,
        GPTSanJapaneseModel,
        GPTSanJapanesePreTrainedModel,
    )
    from .tokenization_gptsan_japanese import GPTSanJapaneseTokenizer


else:
  import sys

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