


"""simple docstring"""






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


SCREAMING_SNAKE_CASE__				:  Optional[int]						= logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__				:  Any						= {
    "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 	A_       (     snake_case__      ,  snake_case__   ):





  """simple docstring"""

  lowercase		:	Optional[int]   =						'convnext'
  def __init__(						self  ,					__UpperCAmelCase=3  ,					__UpperCAmelCase=4  ,					__UpperCAmelCase=4  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase="gelu"  ,					__UpperCAmelCase=0.02  ,					__UpperCAmelCase=1E-1_2  ,					__UpperCAmelCase=1E-6  ,					__UpperCAmelCase=0.0  ,					__UpperCAmelCase=2_24  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					**__UpperCAmelCase  ,					)				->					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   :	Optional[Any]						=    get_aligned_output_features_output_indices(
         out_features=lowerCAmelCase_  ,					out_indices=lowerCAmelCase_  ,					stage_names=self.stage_names						)



class 	A_       (     snake_case__   ):





  """simple docstring"""

  lowercase		:	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_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCAmelCase				 =   {"""configuration_pegasus""": ["""PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusConfig"""]}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   ["""PegasusTokenizer"""]

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   ["""PegasusTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """PegasusForCausalLM""",
      """PegasusForConditionalGeneration""",
      """PegasusModel""",
      """PegasusPreTrainedModel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """TFPegasusForConditionalGeneration""",
      """TFPegasusModel""",
      """TFPegasusPreTrainedModel""",
  ]

try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """FlaxPegasusForConditionalGeneration""",
      """FlaxPegasusModel""",
      """FlaxPegasusPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_pegasus import PegasusTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_pegasus_fast import PegasusTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_pegasus import (
        PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
        PegasusForCausalLM,
        PegasusForConditionalGeneration,
        PegasusModel,
        PegasusPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_pegasus import (
        FlaxPegasusForConditionalGeneration,
        FlaxPegasusModel,
        FlaxPegasusPreTrainedModel,
    )

else:
  import sys

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