
import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


_snake_case				:   Optional[Any]     =				logging.getLogger()


@unittest.skip("""Temporarily disable the doc tests."""			)
@require_torch
@require_tf
@slow
class 			lowerCAmelCase (				unittest.TestCase			):




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase = None					,						UpperCamelCase = None					,						UpperCamelCase = None					,						UpperCamelCase = True					,						):
								_SCREAMING_SNAKE_CASE				= [file for file in os.listdir(_a      ) if os.path.isfile(os.path.join(_a					,						_a      )      )]

								if identifier is not None:
														_SCREAMING_SNAKE_CASE				= [file for file in files if identifier in file]

								if n_identifier is not None:
														if isinstance(_a					,						_a      ):
																				for n_ in n_identifier:
																										_SCREAMING_SNAKE_CASE				= [file for file in files if n_ not in file]
														else:
																				_SCREAMING_SNAKE_CASE				= [file for file in files if n_identifier not in file]

								_SCREAMING_SNAKE_CASE				= ignore_files or []
								ignore_files.append("__init__.py"      )
								_SCREAMING_SNAKE_CASE				= [file for file in files if file not in ignore_files]

								for file in files:
														# Open all files
														print("Testing"					,						_a      )

														if only_modules:
																				_SCREAMING_SNAKE_CASE				= file.split("."      )[0]
																				try:
																										_SCREAMING_SNAKE_CASE				= getattr(_a					,						_a      )
																										_SCREAMING_SNAKE_CASE				= doctest.DocTestSuite(_a      )
																										_SCREAMING_SNAKE_CASE				= unittest.TextTestRunner().run(_a      )
																										self.assertIs(len(result.failures      )					,						0      )
																				except AttributeError:
																										logger.info(F'{module_identifier} is not a module.'      )
														else:
																				_SCREAMING_SNAKE_CASE				= doctest.testfile(str(".." / directory / file      )					,						optionflags=doctest.ELLIPSIS      )
																				self.assertIs(result.failed					,						0      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= Path("src/transformers"      )
								_SCREAMING_SNAKE_CASE				= """modeling"""
								_SCREAMING_SNAKE_CASE				= [
								    """modeling_ctrl.py""",
								    """modeling_tf_ctrl.py""",
								]
								self.analyze_directory(_a					,						identifier=_a					,						ignore_files=_a      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= Path("src/transformers"      )
								_SCREAMING_SNAKE_CASE				= """tokenization"""
								self.analyze_directory(_a					,						identifier=_a      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= Path("src/transformers"      )
								_SCREAMING_SNAKE_CASE				= """configuration"""
								self.analyze_directory(_a					,						identifier=_a      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= Path("src/transformers"      )
								_SCREAMING_SNAKE_CASE				= ["""configuration""", """modeling""", """tokenization"""]
								self.analyze_directory(_a					,						n_identifier=_a      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= Path("docs/source"      )
								_SCREAMING_SNAKE_CASE				= ["""favicon.ico"""]
								self.analyze_directory(_a					,						ignore_files=_a					,						only_modules=_a      )

'''simple docstring'''







from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


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

_snake_case				:   int     =				{
    """YituTech/conv-bert-base""": """https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json""",
    """YituTech/conv-bert-medium-small""": (
        """https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"""
    ),
    """YituTech/conv-bert-small""": """https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json""",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}


class 			lowerCAmelCase (				__UpperCAmelCase			):
		a							:					Tuple       =					"""convbert"""




		def __init__(				self					,						UpperCamelCase=30_522					,						UpperCamelCase=768					,						UpperCamelCase=12					,						UpperCamelCase=12					,						UpperCamelCase=3_072					,						UpperCamelCase="gelu"					,						UpperCamelCase=0.1					,						UpperCamelCase=0.1					,						UpperCamelCase=512					,						UpperCamelCase=2					,						UpperCamelCase=0.02					,						UpperCamelCase=1e-12					,						UpperCamelCase=1					,						UpperCamelCase=0					,						UpperCamelCase=2					,						UpperCamelCase=768					,						UpperCamelCase=2					,						UpperCamelCase=9					,						UpperCamelCase=1					,						UpperCamelCase=None					,						**UpperCamelCase					,						):
								super().__init__(
								    pad_token_id=UpperCamelCase					,						bos_token_id=UpperCamelCase					,						eos_token_id=UpperCamelCase					,						**UpperCamelCase					,						)

								_SCREAMING_SNAKE_CASE				= vocab_size
								_SCREAMING_SNAKE_CASE				= hidden_size
								_SCREAMING_SNAKE_CASE				= num_hidden_layers
								_SCREAMING_SNAKE_CASE				= num_attention_heads
								_SCREAMING_SNAKE_CASE				= intermediate_size
								_SCREAMING_SNAKE_CASE				= hidden_act
								_SCREAMING_SNAKE_CASE				= hidden_dropout_prob
								_SCREAMING_SNAKE_CASE				= attention_probs_dropout_prob
								_SCREAMING_SNAKE_CASE				= max_position_embeddings
								_SCREAMING_SNAKE_CASE				= type_vocab_size
								_SCREAMING_SNAKE_CASE				= initializer_range
								_SCREAMING_SNAKE_CASE				= layer_norm_eps
								_SCREAMING_SNAKE_CASE				= embedding_size
								_SCREAMING_SNAKE_CASE				= head_ratio
								_SCREAMING_SNAKE_CASE				= conv_kernel_size
								_SCREAMING_SNAKE_CASE				= num_groups
								_SCREAMING_SNAKE_CASE				= classifier_dropout


class 			lowerCAmelCase (				__UpperCAmelCase			):




		@property
		def     lowercase       (				self      ):
								if self.task == "multiple-choice":
														_SCREAMING_SNAKE_CASE				= {0: "batch", 1: "choice", 2: "sequence"}
								else:
														_SCREAMING_SNAKE_CASE				= {0: "batch", 1: "sequence"}
								return OrderedDict(
								    [
								        ("input_ids", dynamic_axis),
								        ("attention_mask", dynamic_axis),
								        ("token_type_ids", dynamic_axis),
								    ]      )