






__A  			=					256
# Modulus to hash a string
__A  			=					1000003




def   __A       (  _lowercase       ,      _lowercase			):

					'''simple docstring'''







					_A										=			len(_lowercase			)
					_A										=			len(_lowercase			)
					if p_len > t_len:
										return False

					_A										=			0
					_A										=			0
					_A										=			1

					# Calculating the hash of pattern and substring of text
					for i in range(_lowercase			):
										_A										=			(ord(pattern[i]			) + p_hash * alphabet_size) % modulus
										_A										=			(ord(text[i]			) + text_hash * alphabet_size) % modulus
										if i == p_len - 1:
															continue
										_A										=			(modulus_power * alphabet_size) % modulus

					for i in range(0       ,      t_len - p_len + 1			):
										if text_hash == p_hash and text[i : i + p_len] == pattern:
															return True
										if i == t_len - p_len:
															continue
										# Calculate the https://en.wikipedia.org/wiki/Rolling_hash
										_A										=			(
										    (text_hash - ord(text[i]			) * modulus_power) * alphabet_size
										    + ord(text[i + p_len]			)
										) % modulus
					return False




def   __A       (  ):

					'''simple docstring'''







					_A										=			"abc1abc12"
					_A										=			"alskfjaldsabc1abc1abc12k23adsfabcabc"
					_A										=			"alskfjaldsk23adsfabcabc"
					assert rabin_karp(_lowercase       ,      _lowercase			) and not rabin_karp(_lowercase       ,      _lowercase			)

					# Test 2)
					_A										=			"ABABX"
					_A										=			"ABABZABABYABABX"
					assert rabin_karp(_lowercase       ,      _lowercase			)

					# Test 3)
					_A										=			"AAAB"
					_A										=			"ABAAAAAB"
					assert rabin_karp(_lowercase       ,      _lowercase			)

					# Test 4)
					_A										=			"abcdabcy"
					_A										=			"abcxabcdabxabcdabcdabcy"
					assert rabin_karp(_lowercase       ,      _lowercase			)

					# Test 5)
					_A										=			"Lü"
					_A										=			"Lüsai"
					assert rabin_karp(_lowercase       ,      _lowercase			)
					_A										=			"Lue"
					assert not rabin_karp(_lowercase       ,      _lowercase			)
					print('''Success.'''			)


if __name__ == "__main__":
				test_rabin_karp()




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


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

a  :      Any            =    {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}

class 					_lowercase    (     UpperCAmelCase__			):






    '''simple docstring'''
    SCREAMING_SNAKE_CASE:				int          =    'openai-gpt'
    SCREAMING_SNAKE_CASE:				List[str]          =    {
        'max_position_embeddings': 'n_positions',
        'hidden_size': 'n_embd',
        'num_attention_heads': 'n_head',
        'num_hidden_layers': 'n_layer',
    }




    def __init__(    self       ,						lowerCamelCase__=40_478       ,						lowerCamelCase__=512       ,						lowerCamelCase__=768       ,						lowerCamelCase__=12       ,						lowerCamelCase__=12       ,						lowerCamelCase__="gelu"       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=0.1       ,						lowerCamelCase__=1E-5       ,						lowerCamelCase__=0.0_2       ,						lowerCamelCase__="cls_index"       ,						lowerCamelCase__=True       ,						lowerCamelCase__=None       ,						lowerCamelCase__=True       ,						lowerCamelCase__=0.1       ,						**lowerCamelCase__       ,						):
       lowerCAmelCase_:							Union[str, Any]       =	vocab_size
       lowerCAmelCase_:							List[Any]       =	n_positions
       lowerCAmelCase_:							Tuple       =	n_embd
       lowerCAmelCase_:							Optional[int]       =	n_layer
       lowerCAmelCase_:							Optional[int]       =	n_head
       lowerCAmelCase_:							int       =	afn
       lowerCAmelCase_:							str       =	resid_pdrop
       lowerCAmelCase_:							Optional[int]       =	embd_pdrop
       lowerCAmelCase_:							Optional[int]       =	attn_pdrop
       lowerCAmelCase_:							Dict       =	layer_norm_epsilon
       lowerCAmelCase_:							List[Any]       =	initializer_range
       lowerCAmelCase_:							Union[str, Any]       =	summary_type
       lowerCAmelCase_:							Any       =	summary_use_proj
       lowerCAmelCase_:							Dict       =	summary_activation
       lowerCAmelCase_:							Dict       =	summary_first_dropout
       lowerCAmelCase_:							List[Any]       =	summary_proj_to_labels
       super().__init__(**lowerCamelCase__ )