





'''simple docstring'''



import inspect
import re

from transformers.utils import direct_transformers_import


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_config_docstrings.py
__magic_name__   :						Optional[int]    =			"""src/transformers"""


# This is to make sure the transformers module imported is the one in the repo.
__magic_name__   :						Any    =			direct_transformers_import(PATH_TO_TRANSFORMERS)

__magic_name__   :						Union[str, Any]    =			transformers.models.auto.configuration_auto.CONFIG_MAPPING

# Regex pattern used to find the checkpoint mentioned in the docstring of `config_class`.
# For example, `[bert-base-uncased](https://huggingface.co/bert-base-uncased)`
__magic_name__   :						List[Any]    =			re.compile(r"""\[(.+?)\]\((https://huggingface\.co/.+?)\)""")


__magic_name__   :						Dict    =			{
    """DecisionTransformerConfig""",
    """EncoderDecoderConfig""",
    """MusicgenConfig""",
    """RagConfig""",
    """SpeechEncoderDecoderConfig""",
    """TimmBackboneConfig""",
    """VisionEncoderDecoderConfig""",
    """VisionTextDualEncoderConfig""",
    """LlamaConfig""",
}




def 				snake_case_      (		SCREAMING_SNAKE_CASE__       ):







  '''simple docstring'''



  _snake_case     		=				None

  # source code of `config_class`
  _snake_case     		=				inspect.getsource(SCREAMING_SNAKE_CASE__       )
  _snake_case     		=				_re_checkpoint.findall(SCREAMING_SNAKE_CASE__       )

  # Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
  # For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
  for ckpt_name, ckpt_link in checkpoints:
    # allow the link to end with `/`
    if ckpt_link.endswith("/"       ):
      _snake_case     		=				ckpt_link[:-1]

    # verify the checkpoint name corresponds to the checkpoint link
    _snake_case     		=				f'''https://huggingface.co/{ckpt_name}'''
    if ckpt_link == ckpt_link_from_name:
      _snake_case     		=				ckpt_name
      break

  return checkpoint




def 				snake_case_      (		):







  '''simple docstring'''



  _snake_case     		=				[]

  for config_class in list(CONFIG_MAPPING.values()       ):
    # Skip deprecated models
    if "models.deprecated" in config_class.__module__:
      continue
    _snake_case     		=				get_checkpoint_from_config_class(SCREAMING_SNAKE_CASE__       )

    _snake_case     		=				config_class.__name__
    if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
      configs_without_checkpoint.append(SCREAMING_SNAKE_CASE__       )

  if len(SCREAMING_SNAKE_CASE__       ) > 0:
    _snake_case     		=				"\n".join(sorted(SCREAMING_SNAKE_CASE__       )       )
    raise ValueError(f'''The following configurations don\'t contain any valid checkpoint:\n{message}'''       )


if __name__ == "__main__":
 check_config_docstrings_have_checkpoints()









'''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


__magic_name__   :						Dict    =			logging.get_logger(__name__)

__magic_name__   :						Dict    =			{
    """google/mobilenet_v1_1.0_224""": """https://huggingface.co/google/mobilenet_v1_1.0_224/resolve/main/config.json""",
    """google/mobilenet_v1_0.75_192""": """https://huggingface.co/google/mobilenet_v1_0.75_192/resolve/main/config.json""",
    # See all MobileNetV1 models at https://huggingface.co/models?filter=mobilenet_v1
}


class       __SCREAMING_SNAKE_CASE	(						__UpperCamelCase			):



     '''simple docstring'''






     UpperCAmelCase__       :						List[Any]      =   '''mobilenet_v1'''

     def __init__(					self						,   lowerCamelCase=3						,   lowerCamelCase=224						,   lowerCamelCase=1.0						,   lowerCamelCase=8						,   lowerCamelCase="relu6"						,   lowerCamelCase=True						,   lowerCamelCase=0.999						,   lowerCamelCase=0.02						,   lowerCamelCase=0.001						,   **lowerCamelCase						,   ):
       super().__init__(**lowerCamelCase	)

       if depth_multiplier <= 0:
         raise ValueError("depth_multiplier must be greater than zero."	)

       _snake_case     		=				num_channels
       _snake_case     		=				image_size
       _snake_case     		=				depth_multiplier
       _snake_case     		=				min_depth
       _snake_case     		=				hidden_act
       _snake_case     		=				tf_padding
       _snake_case     		=				classifier_dropout_prob
       _snake_case     		=				initializer_range
       _snake_case     		=				layer_norm_eps







class       __SCREAMING_SNAKE_CASE	(						__UpperCamelCase			):



     '''simple docstring'''






     UpperCAmelCase__       :						int      =   version.parse('''1.11'''			)

     @property
     def 	UpperCamelCase(					self	):
       return OrderedDict([("pixel_values", {0: "batch"})]	)

     @property
     def 	UpperCamelCase(					self	):
       if self.task == "image-classification":
         return OrderedDict([("logits", {0: "batch"})]	)
       else:
         return OrderedDict([("last_hidden_state", {0: "batch"}), ("pooler_output", {0: "batch"})]	)






     @property
     def 	UpperCamelCase(					self	):
       return 1e-4


