


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
_snake_case					:		Tuple      =    "src/transformers"


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

_snake_case					:		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)`
_snake_case					:		str      =    re.compile(R"\[(.+?)\]\((https://huggingface\.co/.+?)\)")


_snake_case					:		str      =    {
    "DecisionTransformerConfig",
    "EncoderDecoderConfig",
    "MusicgenConfig",
    "RagConfig",
    "SpeechEncoderDecoderConfig",
    "TimmBackboneConfig",
    "VisionEncoderDecoderConfig",
    "VisionTextDualEncoderConfig",
    "LlamaConfig",
}







def     lowerCAmelCase_					( __lowerCamelCase     ):
							__snake_case		:      Dict										=       None

							# source code of `config_class`
							__snake_case		:      int										=       inspect.getsource(__lowerCamelCase     )
							__snake_case		:      int										=       _re_checkpoint.findall(__lowerCamelCase     )

							# 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		:      int										=       ckpt_link[:-1]

														# verify the checkpoint name corresponds to the checkpoint link
														__snake_case		:      int										=       F'https://huggingface.co/{ckpt_name}'
														if ckpt_link == ckpt_link_from_name:
																					__snake_case		:      str										=       ckpt_name
																					break

							return checkpoint







def     lowerCAmelCase_					( ):
							__snake_case		:      List[Any]										=       []

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

														__snake_case		:      Optional[Any]										=       config_class.__name__
														if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
																					configs_without_checkpoint.append(__lowerCamelCase     )

							if len(__lowerCamelCase     ) > 0:
														__snake_case		:      Union[str, Any]										=       "\n".join(sorted(__lowerCamelCase     )     )
														raise ValueError(F'The following configurations don\'t contain any valid checkpoint:\n{message}'     )


if __name__ == "__main__":
			check_config_docstrings_have_checkpoints()





from __future__ import annotations

from functools import lru_cache
from math import ceil

_snake_case					:		Tuple      =    100

_snake_case					:		int      =    set(range(3, NUM_PRIMES, 2))
primes.add(2)
_snake_case					:		int

for prime in range(3, ceil(NUM_PRIMES**0.5), 2):
			if prime not in primes:
						continue
			primes.difference_update(set(range(prime * prime, NUM_PRIMES, prime)))







@lru_cache(maxsize=1_0_0     )
def     lowerCAmelCase_					( __lowerCamelCase     ):
							if number_to_partition < 0:
														return set()
							elif number_to_partition == 0:
														return {1}

							__snake_case		:      set[int]										=       set()
							__snake_case		:      int
							__snake_case		:      int

							for prime in primes:
														if prime > number_to_partition:
																					continue
														for sub in partition(number_to_partition - prime     ):
																					ret.add(sub * prime     )

							return ret







def     lowerCAmelCase_					( __lowerCamelCase = 5_0_0_0     ):
							for number_to_partition in range(1							,     __lowerCamelCase     ):
														if len(partition(__lowerCamelCase     )     ) > number_unique_partitions:
																					return number_to_partition
							return None


if __name__ == "__main__":
			print(f'''{solution() = }''')

