


'''simple docstring'''





import functools
import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


UpperCAmelCase__  			=				threading.Lock()
UpperCAmelCase__  			=				None

UpperCAmelCase__  			=				{
    '''debug''': logging.DEBUG,
    '''info''': logging.INFO,
    '''warning''': logging.WARNING,
    '''error''': logging.ERROR,
    '''critical''': logging.CRITICAL,
}

UpperCAmelCase__  			=				logging.WARNING

UpperCAmelCase__  			=				True






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			__A=	os.getenv('TRANSFORMERS_VERBOSITY',_SCREAMING_SNAKE_CASE )
			if env_level_str:
						if env_level_str in log_levels:
									return log_levels[env_level_str]
						else:
									logging.getLogger().warning(
									    f"""Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, """
									    f"""has to be one of: { ", ".join(log_levels.keys() ) }""" )
			return _default_log_level






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return __name__.split('.' )[0]






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return logging.getLogger(_get_library_name() )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			global _default_handler

			with _lock:
						if _default_handler:
									# This library has already configured the library root logger.
									return
						__A=	logging.StreamHandler()  # Set sys.stderr as stream.
						__A=	sys.stderr.flush

						# Apply our default configuration to the library root logger.
						__A=	_get_library_root_logger()
						library_root_logger.addHandler(_default_handler )
						library_root_logger.setLevel(_get_default_logging_level() )
						__A=	False






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			global _default_handler

			with _lock:
						if not _default_handler:
									return

						__A=	_get_library_root_logger()
						library_root_logger.removeHandler(_default_handler )
						library_root_logger.setLevel(logging.NOTSET )
						__A=	None






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return log_levels






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: Optional[str] = None ):






			"""simple docstring"""




			if name is None:
						__A=	_get_library_name()

			_configure_library_root_logger()
			return logging.getLogger(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			_configure_library_root_logger()
			return _get_library_root_logger().getEffectiveLevel()






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int ):






			"""simple docstring"""




			_configure_library_root_logger()
			_get_library_root_logger().setLevel(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return set_verbosity(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return set_verbosity(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return set_verbosity(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			return set_verbosity(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().removeHandler(_default_handler )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().addHandler(_default_handler )






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: logging.Handler ):






			"""simple docstring"""




			_configure_library_root_logger()

			assert handler is not None
			_get_library_root_logger().addHandler(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: logging.Handler ):






			"""simple docstring"""




			_configure_library_root_logger()

			assert handler is not None and handler not in _get_library_root_logger().handlers
			_get_library_root_logger().removeHandler(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			_configure_library_root_logger()
			__A=	False






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			_configure_library_root_logger()
			__A=	True






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			__A=	_get_library_root_logger().handlers

			for handler in handlers:
						__A=	logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s' )
						handler.setFormatter(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			__A=	_get_library_root_logger().handlers

			for handler in handlers:
						handler.setFormatter(_SCREAMING_SNAKE_CASE )






def 						UpperCAmelCase__(				self					: Optional[Any],*_SCREAMING_SNAKE_CASE					: Tuple,**_SCREAMING_SNAKE_CASE					: Optional[int] ):






			"""simple docstring"""




			__A=	os.getenv('TRANSFORMERS_NO_ADVISORY_WARNINGS',_SCREAMING_SNAKE_CASE )
			if no_advisory_warnings:
						return
			self.warning(*_SCREAMING_SNAKE_CASE,**_SCREAMING_SNAKE_CASE )


UpperCAmelCase__  			=				warning_advice






@functools.lru_cache(_SCREAMING_SNAKE_CASE )
def 						UpperCAmelCase__(				self					: Any,*_SCREAMING_SNAKE_CASE					: Optional[int],**_SCREAMING_SNAKE_CASE					: Any ):






			"""simple docstring"""




			self.warning(*_SCREAMING_SNAKE_CASE,**_SCREAMING_SNAKE_CASE )


UpperCAmelCase__  			=				warning_once
class 						a__					:





			'''simple docstring'''

			def __init__(  self							:			str			,    *lowerCAmelCase_							:			Optional[Any]			,    **lowerCAmelCase_							:			int	)      ->		Optional[int]:  # pylint: disable=unused-argument
						__A=	args[0] if args else None
			def __iter__(  self							:			List[str]	)      ->		str:
						return iter(self._iterator	)
			def __getattr__(  self							:			List[Any]			,    lowerCAmelCase_							:			Any	)      ->		List[str]:

						def empty_fn(*lowerCAmelCase_							:			int			,    **lowerCAmelCase_							:			Optional[Any]	):  # pylint: disable=unused-argument
									return

						return empty_fn
			def __enter__(  self							:			int	)      ->		Any:
						return self

			def __exit__(  self							:			Dict			,    lowerCAmelCase_							:			int			,    lowerCAmelCase_							:			str			,    lowerCAmelCase_							:			List[str]	)      ->		str:
						return


class 						a__					:





			'''simple docstring'''

			def __call__(  self							:			str			,    *lowerCAmelCase_							:			Union[str, Any]			,    **lowerCAmelCase_							:			Tuple	)      ->		str:
						if _tqdm_active:
									return tqdm_lib.tqdm(*lowerCAmelCase_			,    **lowerCAmelCase_	)
						else:
									return EmptyTqdm(*lowerCAmelCase_			,    **lowerCAmelCase_	)
			def 					lowerCAmelCase     (  self							:			Optional[Any]			,    *lowerCAmelCase_							:			Dict			,    **lowerCAmelCase_							:			Optional[Any]	)      ->		int:
						__A=	None
						if _tqdm_active:
									return tqdm_lib.tqdm.set_lock(*lowerCAmelCase_			,    **lowerCAmelCase_	)

			def 					lowerCAmelCase     (  self							:			Dict	)      ->		List[Any]:
						if _tqdm_active:
									return tqdm_lib.tqdm.get_lock()


UpperCAmelCase__  			=				_tqdm_cls()






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			global _tqdm_active
			return bool(_tqdm_active )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			global _tqdm_active
			__A=	True
			hf_hub_utils.enable_progress_bars()






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			global _tqdm_active
			__A=	False
			hf_hub_utils.disable_progress_bars()







'''simple docstring'''





from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase__  			=				logging.get_logger(__name__)

UpperCAmelCase__  			=				{
    '''roberta-base''': '''https://huggingface.co/roberta-base/resolve/main/config.json''',
    '''roberta-large''': '''https://huggingface.co/roberta-large/resolve/main/config.json''',
    '''roberta-large-mnli''': '''https://huggingface.co/roberta-large-mnli/resolve/main/config.json''',
    '''distilroberta-base''': '''https://huggingface.co/distilroberta-base/resolve/main/config.json''',
    '''roberta-base-openai-detector''': '''https://huggingface.co/roberta-base-openai-detector/resolve/main/config.json''',
    '''roberta-large-openai-detector''': '''https://huggingface.co/roberta-large-openai-detector/resolve/main/config.json''',
}
class 						a__					(					a_   ):





			'''simple docstring'''

			A						:				Union[str, Any]					      =			'''roberta'''
			def __init__(  self							:			Any			,    lowerCAmelCase_							:			int=50_265			,    lowerCAmelCase_							:			int=768			,    lowerCAmelCase_							:			Optional[Any]=12			,    lowerCAmelCase_							:			Tuple=12			,    lowerCAmelCase_							:			Optional[int]=3_072			,    lowerCAmelCase_							:			List[str]="gelu"			,    lowerCAmelCase_							:			List[str]=0.1			,    lowerCAmelCase_							:			Tuple=0.1			,    lowerCAmelCase_							:			List[Any]=512			,    lowerCAmelCase_							:			Union[str, Any]=2			,    lowerCAmelCase_							:			List[Any]=0.02			,    lowerCAmelCase_							:			Optional[int]=1E-12			,    lowerCAmelCase_							:			str=1			,    lowerCAmelCase_							:			Dict=0			,    lowerCAmelCase_							:			Any=2			,    lowerCAmelCase_							:			List[str]="absolute"			,    lowerCAmelCase_							:			Any=True			,    lowerCAmelCase_							:			Dict=None			,    **lowerCAmelCase_							:			Any			,    )      ->		int:
						super().__init__(pad_token_id=lowerCAmelCase_			,    bos_token_id=lowerCAmelCase_			,    eos_token_id=lowerCAmelCase_			,    **lowerCAmelCase_	)

						__A=	vocab_size
						__A=	hidden_size
						__A=	num_hidden_layers
						__A=	num_attention_heads
						__A=	hidden_act
						__A=	intermediate_size
						__A=	hidden_dropout_prob
						__A=	attention_probs_dropout_prob
						__A=	max_position_embeddings
						__A=	type_vocab_size
						__A=	initializer_range
						__A=	layer_norm_eps
						__A=	position_embedding_type
						__A=	use_cache
						__A=	classifier_dropout


class 						a__					(					a_   ):





			'''simple docstring'''

			@property
			def 					lowerCAmelCase     (  self							:			Any	)      ->		Mapping[str, Mapping[int, str]]:
						if self.task == "multiple-choice":
									__A=	{0: 'batch', 1: 'choice', 2: 'sequence'}
						else:
									__A=	{0: 'batch', 1: 'sequence'}
						return OrderedDict(
						    [
						        ('input_ids', dynamic_axis),
						        ('attention_mask', dynamic_axis),
						    ]	)



