






"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_SCREAMING_SNAKE_CASE :    Any    =						{
    'configuration_flava': [
        'FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'FlavaConfig',
        'FlavaImageCodebookConfig',
        'FlavaImageConfig',
        'FlavaMultimodalConfig',
        'FlavaTextConfig',
    ],
}

try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _SCREAMING_SNAKE_CASE :    Tuple    =						['FlavaFeatureExtractor']
  _SCREAMING_SNAKE_CASE :    Optional[int]    =						['FlavaImageProcessor']
  _SCREAMING_SNAKE_CASE :    int    =						['FlavaProcessor']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _SCREAMING_SNAKE_CASE :    List[str]    =						[
      'FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST',
      'FlavaForPreTraining',
      'FlavaImageCodebook',
      'FlavaImageModel',
      'FlavaModel',
      'FlavaMultimodalModel',
      'FlavaPreTrainedModel',
      'FlavaTextModel',
  ]

if TYPE_CHECKING:
  from .configuration_flava import (
      FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP,
      FlavaConfig,
      FlavaImageCodebookConfig,
      FlavaImageConfig,
      FlavaMultimodalConfig,
      FlavaTextConfig,
  )

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_flava import FlavaFeatureExtractor
    from .image_processing_flava import FlavaImageProcessor
    from .processing_flava import FlavaProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flava import (
        FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST,
        FlavaForPreTraining,
        FlavaImageCodebook,
        FlavaImageModel,
        FlavaModel,
        FlavaMultimodalModel,
        FlavaPreTrainedModel,
        FlavaTextModel,
    )

else:
  import sys

  _SCREAMING_SNAKE_CASE :    int    =						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)












"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE :    List[Any]    =						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE :    str    =						{
    '''facebook/regnet-y-040''': '''https://huggingface.co/facebook/regnet-y-040/blob/main/config.json''',
}






class 					a						( __snake_case		):
    SCREAMING_SNAKE_CASE						:					str						=			"""regnet"""
    SCREAMING_SNAKE_CASE						:					List[Any]						=			["""x""", """y"""]






    def __init__(	self					:							int	,						__SCREAMING_SNAKE_CASE					:							Any=3	,						__SCREAMING_SNAKE_CASE					:							Any=32	,						__SCREAMING_SNAKE_CASE					:							List[str]=[128, 192, 512, 1088]	,						__SCREAMING_SNAKE_CASE					:							Union[str, Any]=[2, 6, 12, 2]	,						__SCREAMING_SNAKE_CASE					:							str=64	,						__SCREAMING_SNAKE_CASE					:							List[Any]="y"	,						__SCREAMING_SNAKE_CASE					:							Optional[int]="relu"	,						**__SCREAMING_SNAKE_CASE					:							Union[str, Any]	,						)					->		Union[str, Any]:
      super().__init__(**__SCREAMING_SNAKE_CASE )
      if layer_type not in self.layer_types:
        raise ValueError(F'''layer_type={layer_type} is not one of {",".join(self.layer_types )}''' )
      lowerCamelCase_   					=						num_channels
      lowerCamelCase_   					=						embedding_size
      lowerCamelCase_   					=						hidden_sizes
      lowerCamelCase_   					=						depths
      lowerCamelCase_   					=						groups_width
      lowerCamelCase_   					=						layer_type
      lowerCamelCase_   					=						hidden_act
      # always downsample in the first stage
      lowerCamelCase_   					=						True




