


lowerCAmelCase__       :	List[str]     				={
    '0000': '0',
    '0001': '1',
    '0010': '2',
    '0011': '3',
    '0100': '4',
    '0101': '5',
    '0110': '6',
    '0111': '7',
    '1000': '8',
    '1001': '9',
    '1010': 'a',
    '1011': 'b',
    '1100': 'c',
    '1101': 'd',
    '1110': 'e',
    '1111': 'f',
}






def 		a__       (							A__							):
			SCREAMING_SNAKE_CASE_						:			List[str]       						= str(A__							).strip()

			# Exceptions
			if not binary_str:
						raise ValueError('Empty string was passed to the function'							)
			SCREAMING_SNAKE_CASE_						:			Dict       						= binary_str[0] == '-'
			SCREAMING_SNAKE_CASE_						:			str       						= binary_str[1:] if is_negative else binary_str
			if not all(char in '01' for char in binary_str							):
						raise ValueError('Non-binary value was passed to the function'							)

			SCREAMING_SNAKE_CASE_						:			Optional[int]       						= (
			    '0' * (4 * (divmod(len(A__							),	4							)[0] + 1) - len(A__							)) + binary_str
			)

			SCREAMING_SNAKE_CASE_						:			Dict       						= []
			for x in range(0,	len(A__							),	4							):
						hexadecimal.append(BITS_TO_HEX[binary_str[x : x + 4]]							)
			SCREAMING_SNAKE_CASE_						:			Any       						= '0x' + ''.join(A__							)

			return "-" + hexadecimal_str if is_negative else hexadecimal_str


if __name__ == "__main__":
				from doctest import testmod

				testmod()









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


lowerCAmelCase__       :	Any     				=logging.get_logger(__name__)

lowerCAmelCase__       :	Union[str, Any]     				={
    'google/reformer-crime-and-punishment': (
        'https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/config.json'
    ),
    'google/reformer-enwik8': 'https://huggingface.co/google/reformer-enwik8/resolve/main/config.json',
}







class      __lowercase  (__SCREAMING_SNAKE_CASE   ):





							"""simple docstring"""







							_UpperCAmelCase     =		"""reformer"""
							_UpperCAmelCase     =		["""past_buckets_states"""]
							_UpperCAmelCase     =		{}






							def __init__(	self       ,		lowerCAmelCase__=6_4       ,		lowerCAmelCase__=["local", "lsh", "local", "lsh", "local", "lsh"]       ,		lowerCAmelCase__=1.0       ,		lowerCAmelCase__=True       ,		lowerCAmelCase__=[6_4, 6_4]       ,		lowerCAmelCase__=[6_4, 1_9_2]       ,		lowerCAmelCase__=0       ,		lowerCAmelCase__=2       ,		lowerCAmelCase__=5_1_2       ,		lowerCAmelCase__=None       ,		lowerCAmelCase__="relu"       ,		lowerCAmelCase__=0.05       ,		lowerCAmelCase__=2_5_6       ,		lowerCAmelCase__=0.02       ,		lowerCAmelCase__=False       ,		lowerCAmelCase__=1E-12       ,		lowerCAmelCase__=1       ,		lowerCAmelCase__=0       ,		lowerCAmelCase__=0.05       ,		lowerCAmelCase__=6_4       ,		lowerCAmelCase__=6_4       ,		lowerCAmelCase__=0.0       ,		lowerCAmelCase__=1       ,		lowerCAmelCase__=0       ,		lowerCAmelCase__=4_0_9_6       ,		lowerCAmelCase__=1_2       ,		lowerCAmelCase__=None       ,		lowerCAmelCase__=1       ,		lowerCAmelCase__=0       ,		lowerCAmelCase__=3_2_0       ,		lowerCAmelCase__=False       ,		lowerCAmelCase__=True       ,		lowerCAmelCase__=None       ,		**lowerCAmelCase__       ,		):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_						:			str       						= hash_seed
										SCREAMING_SNAKE_CASE_						:			Union[str, Any]       						= vocab_size
										SCREAMING_SNAKE_CASE_						:			Any       						= attention_head_size
										SCREAMING_SNAKE_CASE_						:			List[Any]       						= hidden_size
										SCREAMING_SNAKE_CASE_						:			Optional[Any]       						= num_attention_heads
										SCREAMING_SNAKE_CASE_						:			Any       						= num_hashes
										SCREAMING_SNAKE_CASE_						:			int       						= len(lowerCAmelCase__    )
										SCREAMING_SNAKE_CASE_						:			str       						= tuple(lowerCAmelCase__    ) if isinstance(lowerCAmelCase__       ,		lowerCAmelCase__    ) else num_buckets
										SCREAMING_SNAKE_CASE_						:			int       						= lsh_attn_chunk_length
										SCREAMING_SNAKE_CASE_						:			List[str]       						= local_attn_chunk_length
										SCREAMING_SNAKE_CASE_						:			Tuple       						= lsh_num_chunks_after
										SCREAMING_SNAKE_CASE_						:			str       						= lsh_num_chunks_before
										SCREAMING_SNAKE_CASE_						:			List[Any]       						= local_num_chunks_after
										SCREAMING_SNAKE_CASE_						:			Any       						= local_num_chunks_before
										SCREAMING_SNAKE_CASE_						:			Any       						= hidden_act
										SCREAMING_SNAKE_CASE_						:			Dict       						= feed_forward_size
										SCREAMING_SNAKE_CASE_						:			Optional[int]       						= hidden_dropout_prob
										SCREAMING_SNAKE_CASE_						:			Tuple       						= lsh_attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_						:			Any       						= local_attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE_						:			str       						= max_position_embeddings
										SCREAMING_SNAKE_CASE_						:			Optional[int]       						= initializer_range
										SCREAMING_SNAKE_CASE_						:			Optional[Any]       						= layer_norm_eps
										SCREAMING_SNAKE_CASE_						:			List[str]       						= axial_pos_embds
										SCREAMING_SNAKE_CASE_						:			List[str]       						= tuple(lowerCAmelCase__    )
										SCREAMING_SNAKE_CASE_						:			Tuple       						= tuple(lowerCAmelCase__    )
										SCREAMING_SNAKE_CASE_						:			Dict       						= axial_norm_std
										SCREAMING_SNAKE_CASE_						:			Any       						= chunk_size_lm_head
										SCREAMING_SNAKE_CASE_						:			int       						= attn_layers
										SCREAMING_SNAKE_CASE_						:			Union[str, Any]       						= use_cache
										SCREAMING_SNAKE_CASE_						:			Tuple       						= classifier_dropout
										super().__init__(
										    pad_token_id=lowerCAmelCase__       ,		eos_token_id=lowerCAmelCase__       ,		is_decoder=lowerCAmelCase__       ,		tie_word_embeddings=lowerCAmelCase__       ,		**lowerCAmelCase__       ,		)





