"""simple docstring"""





import pickle

import numpy as np
from matplotlib import pyplot as plt
class  _snake_case     :






						def __init__(       self      :			Tuple							,					UpperCAmelCase      :			Dict							,					UpperCAmelCase      :			Union[str, Any]							,					UpperCAmelCase      :			Any							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			int=0.2							,					UpperCAmelCase      :			Any=0.2    ):
													__lowerCamelCase					:		Tuple		   =     bp_numa
													__lowerCamelCase					:		int		   =     bp_numa
													__lowerCamelCase					:		Optional[int]		   =     bp_numa
													__lowerCamelCase					:		Union[str, Any]		   =     conva_get[:2]
													__lowerCamelCase					:		Tuple		   =     conva_get[2]
													__lowerCamelCase					:		List[str]		   =     size_pa
													__lowerCamelCase					:		Union[str, Any]		   =     rate_w
													__lowerCamelCase					:		str		   =     rate_t
													__lowerCamelCase					:		Optional[int]		   =     [
													    np.mat(-1 * np.random.rand(self.conva[0]							,					self.conva[0]    ) + 0.5    )
													    for i in range(self.conva[1]    )
													]
													__lowerCamelCase					:		Union[str, Any]		   =     np.mat(-1 * np.random.rand(self.num_bpa							,					self.num_bpa    ) + 0.5    )
													__lowerCamelCase					:		Any		   =     np.mat(-1 * np.random.rand(self.num_bpa							,					self.num_bpa    ) + 0.5    )
													__lowerCamelCase					:		int		   =     -2 * np.random.rand(self.conva[1]    ) + 1
													__lowerCamelCase					:		Tuple		   =     -2 * np.random.rand(self.num_bpa    ) + 1
													__lowerCamelCase					:		List[Any]		   =     -2 * np.random.rand(self.num_bpa    ) + 1






						def       lowerCamelCase__     (       self      :			Tuple							,					UpperCAmelCase      :			Union[str, Any]    ):
													# save model dict with pickle
													__lowerCamelCase					:		Tuple		   =     {
													    "num_bp1": self.num_bpa,
													    "num_bp2": self.num_bpa,
													    "num_bp3": self.num_bpa,
													    "conv1": self.conva,
													    "step_conv1": self.step_conva,
													    "size_pooling1": self.size_poolinga,
													    "rate_weight": self.rate_weight,
													    "rate_thre": self.rate_thre,
													    "w_conv1": self.w_conva,
													    "wkj": self.wkj,
													    "vji": self.vji,
													    "thre_conv1": self.thre_conva,
													    "thre_bp2": self.thre_bpa,
													    "thre_bp3": self.thre_bpa,
													}
													with open(UpperCAmelCase							,					"wb"    ) as f:
																				pickle.dump(UpperCAmelCase							,					UpperCAmelCase    )

													print(F"""Model saved： {save_path}"""    )






						@classmethod
						def       lowerCamelCase__     (       cls      :			Dict							,					UpperCAmelCase      :			List[Any]    ):
													# read saved model
													with open(UpperCAmelCase							,					"rb"    ) as f:
																				__lowerCamelCase					:		Optional[Any]		   =     pickle.load(UpperCAmelCase    )  # noqa: S301

													__lowerCamelCase					:		Optional[Any]		   =     model_dic.get("conv1"    )
													conv_get.append(model_dic.get("step_conv1"    )    )
													__lowerCamelCase					:		Tuple		   =     model_dic.get("size_pooling1"    )
													__lowerCamelCase					:		Tuple		   =     model_dic.get("num_bp1"    )
													__lowerCamelCase					:		List[str]		   =     model_dic.get("num_bp2"    )
													__lowerCamelCase					:		str		   =     model_dic.get("num_bp3"    )
													__lowerCamelCase					:		str		   =     model_dic.get("rate_weight"    )
													__lowerCamelCase					:		int		   =     model_dic.get("rate_thre"    )
													# create model instance
													__lowerCamelCase					:		List[str]		   =     CNN(UpperCAmelCase							,					UpperCAmelCase							,					UpperCAmelCase							,					UpperCAmelCase							,					UpperCAmelCase							,					UpperCAmelCase							,					UpperCAmelCase    )
													# modify model parameter
													__lowerCamelCase					:		str		   =     model_dic.get("w_conv1"    )
													__lowerCamelCase					:		Dict		   =     model_dic.get("wkj"    )
													__lowerCamelCase					:		Tuple		   =     model_dic.get("vji"    )
													__lowerCamelCase					:		List[Any]		   =     model_dic.get("thre_conv1"    )
													__lowerCamelCase					:		Tuple		   =     model_dic.get("thre_bp2"    )
													__lowerCamelCase					:		str		   =     model_dic.get("thre_bp3"    )
													return conv_ins






						def       lowerCamelCase__     (       self      :			int							,					UpperCAmelCase      :			str    ):
													return 1 / (1 + np.exp(-1 * x    ))






						def       lowerCamelCase__     (       self      :			int							,					UpperCAmelCase      :			int    ):
													return round(UpperCAmelCase							,					3    )






						def       lowerCamelCase__     (       self      :			Optional[Any]							,					UpperCAmelCase      :			List[Any]							,					UpperCAmelCase      :			str							,					UpperCAmelCase      :			Optional[int]							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			Dict    ):
													# convolution process
													__lowerCamelCase					:		Tuple		   =     convs[0]
													__lowerCamelCase					:		Any		   =     convs[1]
													__lowerCamelCase					:		List[Any]		   =     np.shape(UpperCAmelCase    )[0]
													# get the data slice of original image data, data_focus
													__lowerCamelCase					:		int		   =     []
													for i_focus in range(0							,					size_data - size_conv + 1							,					UpperCAmelCase    ):
																				for j_focus in range(0							,					size_data - size_conv + 1							,					UpperCAmelCase    ):
																											__lowerCamelCase					:		Optional[int]		   =     data[
																											    i_focus : i_focus + size_conv, j_focus : j_focus + size_conv
																											]
																											data_focus.append(UpperCAmelCase    )
        # calculate the feature map of every single kernel, and saved as list of matrix
													__lowerCamelCase					:		List[Any]		   =     []
													__lowerCamelCase					:		str		   =     int((size_data - size_conv) / conv_step + 1    )
													for i_map in range(UpperCAmelCase    ):
																				__lowerCamelCase					:		Tuple		   =     []
																				for i_focus in range(len(UpperCAmelCase    )    ):
																											__lowerCamelCase					:		Optional[int]		   =     (
																											    np.sum(np.multiply(data_focus[i_focus]							,					w_convs[i_map]    )    )
																											    - thre_convs[i_map]
																											)
																											featuremap.append(self.sig(UpperCAmelCase    )    )
																				__lowerCamelCase					:		Optional[Any]		   =     np.asmatrix(UpperCAmelCase    ).reshape(
																				    UpperCAmelCase							,					UpperCAmelCase    )
																				data_featuremap.append(UpperCAmelCase    )

													# expanding the data slice to One dimenssion
													__lowerCamelCase					:		Any		   =     []
													for each_focus in data_focus:
																				focusa_list.extend(self.Expand_Mat(UpperCAmelCase    )    )
													__lowerCamelCase					:		Optional[int]		   =     np.asarray(UpperCAmelCase    )
													return focus_list, data_featuremap






						def       lowerCamelCase__     (       self      :			Tuple							,					UpperCAmelCase      :			List[str]							,					UpperCAmelCase      :			Tuple							,					UpperCAmelCase      :			Dict="average_pool"    ):
													# pooling process
													__lowerCamelCase					:		Any		   =     len(featuremaps[0]    )
													__lowerCamelCase					:		Optional[int]		   =     int(size_map / size_pooling    )
													__lowerCamelCase					:		Union[str, Any]		   =     []
													for i_map in range(len(UpperCAmelCase    )    ):
																				__lowerCamelCase					:		Union[str, Any]		   =     featuremaps[i_map]
																				__lowerCamelCase					:		str		   =     []
																				for i_focus in range(0							,					UpperCAmelCase							,					UpperCAmelCase    ):
																											for j_focus in range(0							,					UpperCAmelCase							,					UpperCAmelCase    ):
																																		__lowerCamelCase					:		List[str]		   =     feature_map[
																																		    i_focus : i_focus + size_pooling,
																																		    j_focus : j_focus + size_pooling,
																																		]
																																		if pooling_type == "average_pool":
																																									# average pooling
																																									map_pooled.append(np.average(UpperCAmelCase    )    )
																																		elif pooling_type == "max_pooling":
																																									# max pooling
																																									map_pooled.append(np.max(UpperCAmelCase    )    )
																				__lowerCamelCase					:		List[str]		   =     np.asmatrix(UpperCAmelCase    ).reshape(UpperCAmelCase							,					UpperCAmelCase    )
																				featuremap_pooled.append(UpperCAmelCase    )
													return featuremap_pooled






						def       lowerCamelCase__     (       self      :			Any							,					UpperCAmelCase      :			str    ):
													# expanding three dimension data to one dimension list
													__lowerCamelCase					:		Tuple		   =     []
													for i in range(len(UpperCAmelCase    )    ):
																				__lowerCamelCase					:		Any		   =     np.shape(data[i]    )
																				__lowerCamelCase					:		Tuple		   =     data[i].reshape(1							,					shapes[0] * shapes[1]    )
																				__lowerCamelCase					:		List[str]		   =     data_listed.getA().tolist()[0]
																				data_expanded.extend(UpperCAmelCase    )
													__lowerCamelCase					:		Any		   =     np.asarray(UpperCAmelCase    )
													return data_expanded






						def       lowerCamelCase__     (       self      :			List[Any]							,					UpperCAmelCase      :			List[str]    ):
													# expanding matrix to one dimension list
													__lowerCamelCase					:		str		   =     np.asarray(UpperCAmelCase    )
													__lowerCamelCase					:		Dict		   =     np.shape(UpperCAmelCase    )
													__lowerCamelCase					:		Union[str, Any]		   =     data_mat.reshape(1							,					shapes[0] * shapes[1]    )
													return data_expanded






						def       lowerCamelCase__     (       self      :			int							,					UpperCAmelCase      :			Tuple							,					UpperCAmelCase      :			Union[str, Any]							,					UpperCAmelCase      :			Optional[Any]							,					UpperCAmelCase      :			Any							,					UpperCAmelCase      :			str    ):
													__lowerCamelCase					:		Union[str, Any]		   =     []
													__lowerCamelCase					:		Optional[int]		   =     0
													for i_map in range(UpperCAmelCase    ):
																				__lowerCamelCase					:		Dict		   =     np.ones((size_map, size_map)    )
																				for i in range(0							,					UpperCAmelCase							,					UpperCAmelCase    ):
																											for j in range(0							,					UpperCAmelCase							,					UpperCAmelCase    ):
																																		__lowerCamelCase					:		List[Any]		   =     pd_pool[
																																		    i_pool
																																		]
																																		__lowerCamelCase					:		Tuple		   =     i_pool + 1
																				__lowerCamelCase					:		Union[str, Any]		   =     np.multiply(
																				    UpperCAmelCase							,					np.multiply(out_map[i_map]							,					(1 - out_map[i_map])    )    )
																				pd_all.append(UpperCAmelCase    )
													return pd_all






						def       lowerCamelCase__     (       self      :			Union[str, Any]							,					UpperCAmelCase      :			Optional[Any]							,					UpperCAmelCase      :			List[str]							,					UpperCAmelCase      :			Dict							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			Union[str, Any]							,					UpperCAmelCase      :			List[Any]=bool    ):
													# model traning
													print("----------------------Start Training-------------------------"    )
													print((" - - Shape: Train_Data  ", np.shape(UpperCAmelCase    ))    )
													print((" - - Shape: Teach_Data  ", np.shape(UpperCAmelCase    ))    )
													__lowerCamelCase					:		str		   =     0
													__lowerCamelCase					:		List[Any]		   =     []
													__lowerCamelCase					:		Optional[Any]		   =     10000
													while rp < n_repeat and mse >= error_accuracy:
																				__lowerCamelCase					:		List[Any]		   =     0
																				print(F"""-------------Learning Time {rp}--------------"""    )
																				for p in range(len(UpperCAmelCase    )    ):
																											# print('------------Learning Image: %d--------------'%p)
																											__lowerCamelCase					:		Optional[int]		   =     np.asmatrix(datas_train[p]    )
																											__lowerCamelCase					:		Union[str, Any]		   =     np.asarray(datas_teach[p]    )
																											__lowerCamelCase					:		Union[str, Any]		   =     self.convolute(
																											    UpperCAmelCase							,					self.conva							,					self.w_conva							,					self.thre_conva							,					conv_step=self.step_conva							,					)
																											__lowerCamelCase					:		List[str]		   =     self.pooling(UpperCAmelCase							,					self.size_poolinga    )
																											__lowerCamelCase					:		Union[str, Any]		   =     np.shape(UpperCAmelCase    )
																											__lowerCamelCase					:		int		   =     self._expand(UpperCAmelCase    )
																											__lowerCamelCase					:		List[str]		   =     data_bp_input

																											__lowerCamelCase					:		Dict		   =     np.dot(UpperCAmelCase							,					self.vji.T    ) - self.thre_bpa
																											__lowerCamelCase					:		int		   =     self.sig(UpperCAmelCase    )
																											__lowerCamelCase					:		List[str]		   =     np.dot(UpperCAmelCase							,					self.wkj.T    ) - self.thre_bpa
																											__lowerCamelCase					:		Optional[int]		   =     self.sig(UpperCAmelCase    )

																											# --------------Model Leaning ------------------------
																											# calculate error and gradient---------------
																											__lowerCamelCase					:		str		   =     np.multiply(
																											    (data_teach - bp_outa)							,					np.multiply(UpperCAmelCase							,					(1 - bp_outa)    )    )
																											__lowerCamelCase					:		List[str]		   =     np.multiply(
																											    np.dot(UpperCAmelCase							,					self.wkj    )							,					np.multiply(UpperCAmelCase							,					(1 - bp_outa)    )    )
																											__lowerCamelCase					:		Any		   =     np.dot(UpperCAmelCase							,					self.vji    )

																											__lowerCamelCase					:		Dict		   =     pd_i_all / (self.size_poolinga * self.size_poolinga)
																											__lowerCamelCase					:		Optional[int]		   =     pd_conva_pooled.T.getA().tolist()
																											__lowerCamelCase					:		List[str]		   =     self._calculate_gradient_from_pool(
																											    UpperCAmelCase							,					UpperCAmelCase							,					shape_featuremapa[0]							,					shape_featuremapa[1]							,					self.size_poolinga							,					)
																											# weight and threshold learning process---------
																											# convolution layer
																											for k_conv in range(self.conva[1]    ):
																																		__lowerCamelCase					:		str		   =     self._expand_mat(pd_conva_all[k_conv]    )
																																		__lowerCamelCase					:		Optional[Any]		   =     self.rate_weight * np.dot(UpperCAmelCase							,					UpperCAmelCase    )

																																		__lowerCamelCase					:		Tuple		   =     self.w_conva[k_conv] + delta_w.reshape(
																																		    (self.conva[0], self.conva[0])    )

																																		__lowerCamelCase					:		str		   =     (
																																		    self.thre_conva[k_conv]
																																		    - np.sum(pd_conva_all[k_conv]    ) * self.rate_thre
																																		)
																											# all connected layer
																											__lowerCamelCase					:		Dict		   =     self.wkj + pd_k_all.T * bp_outa * self.rate_weight
																											__lowerCamelCase					:		Any		   =     self.vji + pd_j_all.T * bp_outa * self.rate_weight
																											__lowerCamelCase					:		Tuple		   =     self.thre_bpa - pd_k_all * self.rate_thre
																											__lowerCamelCase					:		List[str]		   =     self.thre_bpa - pd_j_all * self.rate_thre
																											# calculate the sum error of all single image
																											__lowerCamelCase					:		Any		   =     np.sum(abs(data_teach - bp_outa    )    )
																											error_count += errors
																											# print('   ----Teach      ',data_teach)
																											# print('   ----BP_output  ',bp_out3)
																				__lowerCamelCase					:		Optional[int]		   =     rp + 1
																				__lowerCamelCase					:		Dict		   =     error_count / patterns
																				all_mse.append(UpperCAmelCase    )

													def draw_error():
																				__lowerCamelCase					:		Optional[Any]		   =     [error_accuracy for i in range(int(n_repeat * 1.2    )    )]
																				plt.plot(UpperCAmelCase							,					"+-"    )
																				plt.plot(UpperCAmelCase							,					"r--"    )
																				plt.xlabel("Learning Times"    )
																				plt.ylabel("All_mse"    )
																				plt.grid(UpperCAmelCase							,					alpha=0.5    )
																				plt.show()

													print("------------------Training Complished---------------------"    )
													print((" - - Training epoch: ", rp, F"""     - - Mse: {mse:.6f}""")    )
													if draw_e:
																				draw_error()
													return mse






						def       lowerCamelCase__     (       self      :			Optional[int]							,					UpperCAmelCase      :			Optional[Any]    ):
													# model predict
													__lowerCamelCase					:		List[Any]		   =     []
													print("-------------------Start Testing-------------------------"    )
													print((" - - Shape: Test_Data  ", np.shape(UpperCAmelCase    ))    )
													for p in range(len(UpperCAmelCase    )    ):
																				__lowerCamelCase					:		Optional[int]		   =     np.asmatrix(datas_test[p]    )
																				__lowerCamelCase					:		List[Any]		   =     self.convolute(
																				    UpperCAmelCase							,					self.conva							,					self.w_conva							,					self.thre_conva							,					conv_step=self.step_conva							,					)
																				__lowerCamelCase					:		List[str]		   =     self.pooling(UpperCAmelCase							,					self.size_poolinga    )
																				__lowerCamelCase					:		Union[str, Any]		   =     self._expand(UpperCAmelCase    )

																				__lowerCamelCase					:		int		   =     data_bp_input
																				__lowerCamelCase					:		List[Any]		   =     bp_outa * self.vji.T - self.thre_bpa
																				__lowerCamelCase					:		List[str]		   =     self.sig(UpperCAmelCase    )
																				__lowerCamelCase					:		str		   =     bp_outa * self.wkj.T - self.thre_bpa
																				__lowerCamelCase					:		Any		   =     self.sig(UpperCAmelCase    )
																				produce_out.extend(bp_outa.getA().tolist()    )
													__lowerCamelCase					:		Dict		   =     [list(map(self.do_round							,					UpperCAmelCase    )    ) for each in produce_out]
													return np.asarray(UpperCAmelCase    )







						def       lowerCamelCase__     (       self      :			Tuple							,					UpperCAmelCase      :			Optional[int]    ):
													# return the data of image after convoluting process so we can check it out
													__lowerCamelCase					:		List[Any]		   =     np.asmatrix(UpperCAmelCase    )
													__lowerCamelCase					:		List[Any]		   =     self.convolute(
													    UpperCAmelCase							,					self.conva							,					self.w_conva							,					self.thre_conva							,					conv_step=self.step_conva							,					)
													__lowerCamelCase					:		Union[str, Any]		   =     self.pooling(UpperCAmelCase							,					self.size_poolinga    )

													return data_conveda, data_pooleda


if __name__ == "__main__":
				pass
"""simple docstring"""





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_funnel import FunnelTokenizer


__A  =				logging.get_logger(__name__)

__A  =				{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__A  =				[
    '''small''',
    '''small-base''',
    '''medium''',
    '''medium-base''',
    '''intermediate''',
    '''intermediate-base''',
    '''large''',
    '''large-base''',
    '''xlarge''',
    '''xlarge-base''',
]

__A  =				{
    '''vocab_file''': {
        '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/main/vocab.txt''',
        '''funnel-transformer/small-base''': '''https://huggingface.co/funnel-transformer/small-base/resolve/main/vocab.txt''',
        '''funnel-transformer/medium''': '''https://huggingface.co/funnel-transformer/medium/resolve/main/vocab.txt''',
        '''funnel-transformer/medium-base''': (
            '''https://huggingface.co/funnel-transformer/medium-base/resolve/main/vocab.txt'''
        ),
        '''funnel-transformer/intermediate''': (
            '''https://huggingface.co/funnel-transformer/intermediate/resolve/main/vocab.txt'''
        ),
        '''funnel-transformer/intermediate-base''': (
            '''https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/vocab.txt'''
        ),
        '''funnel-transformer/large''': '''https://huggingface.co/funnel-transformer/large/resolve/main/vocab.txt''',
        '''funnel-transformer/large-base''': '''https://huggingface.co/funnel-transformer/large-base/resolve/main/vocab.txt''',
        '''funnel-transformer/xlarge''': '''https://huggingface.co/funnel-transformer/xlarge/resolve/main/vocab.txt''',
        '''funnel-transformer/xlarge-base''': (
            '''https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/main/tokenizer.json''',
        '''funnel-transformer/small-base''': (
            '''https://huggingface.co/funnel-transformer/small-base/resolve/main/tokenizer.json'''
        ),
        '''funnel-transformer/medium''': '''https://huggingface.co/funnel-transformer/medium/resolve/main/tokenizer.json''',
        '''funnel-transformer/medium-base''': (
            '''https://huggingface.co/funnel-transformer/medium-base/resolve/main/tokenizer.json'''
        ),
        '''funnel-transformer/intermediate''': (
            '''https://huggingface.co/funnel-transformer/intermediate/resolve/main/tokenizer.json'''
        ),
        '''funnel-transformer/intermediate-base''': (
            '''https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/tokenizer.json'''
        ),
        '''funnel-transformer/large''': '''https://huggingface.co/funnel-transformer/large/resolve/main/tokenizer.json''',
        '''funnel-transformer/large-base''': (
            '''https://huggingface.co/funnel-transformer/large-base/resolve/main/tokenizer.json'''
        ),
        '''funnel-transformer/xlarge''': '''https://huggingface.co/funnel-transformer/xlarge/resolve/main/tokenizer.json''',
        '''funnel-transformer/xlarge-base''': (
            '''https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/tokenizer.json'''
        ),
    },
}
__A  =				{F"""funnel-transformer/{name}""": 512 for name in _model_names}
__A  =				{F"""funnel-transformer/{name}""": {'''do_lower_case''': True} for name in _model_names}
class  _snake_case     (					a__		):
						snake_case__			  =			VOCAB_FILES_NAMES
						snake_case__			  =			PRETRAINED_VOCAB_FILES_MAP
						snake_case__			  =			PRETRAINED_INIT_CONFIGURATION
						snake_case__			  =			FunnelTokenizer
						snake_case__			  =			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						snake_case__			  =			2






						def __init__(       self      :			List[Any]							,					UpperCAmelCase      :			List[str]=None							,					UpperCAmelCase      :			Optional[int]=None							,					UpperCAmelCase      :			List[Any]=True							,					UpperCAmelCase      :			int="<unk>"							,					UpperCAmelCase      :			List[Any]="<sep>"							,					UpperCAmelCase      :			List[str]="<pad>"							,					UpperCAmelCase      :			Union[str, Any]="<cls>"							,					UpperCAmelCase      :			int="<mask>"							,					UpperCAmelCase      :			List[str]="<s>"							,					UpperCAmelCase      :			Union[str, Any]="</s>"							,					UpperCAmelCase      :			List[Any]=True							,					UpperCAmelCase      :			Tuple=True							,					UpperCAmelCase      :			int=None							,					UpperCAmelCase      :			int="##"							,					**UpperCAmelCase      :			Dict							,					):
													super().__init__(
													    UpperCAmelCase							,					tokenizer_file=UpperCAmelCase							,					do_lower_case=UpperCAmelCase							,					unk_token=UpperCAmelCase							,					sep_token=UpperCAmelCase							,					pad_token=UpperCAmelCase							,					cls_token=UpperCAmelCase							,					mask_token=UpperCAmelCase							,					bos_token=UpperCAmelCase							,					eos_token=UpperCAmelCase							,					clean_text=UpperCAmelCase							,					tokenize_chinese_chars=UpperCAmelCase							,					strip_accents=UpperCAmelCase							,					wordpieces_prefix=UpperCAmelCase							,					**UpperCAmelCase							,					)

													__lowerCamelCase					:		List[Any]		   =     json.loads(self.backend_tokenizer.normalizer.__getstate__()    )
													if (
													    normalizer_state.get("lowercase"							,					UpperCAmelCase    ) != do_lower_case
													    or normalizer_state.get("strip_accents"							,					UpperCAmelCase    ) != strip_accents
													    or normalizer_state.get("handle_chinese_chars"							,					UpperCAmelCase    ) != tokenize_chinese_chars
													):
																				__lowerCamelCase					:		Tuple		   =     getattr(UpperCAmelCase							,					normalizer_state.pop("type"    )    )
																				__lowerCamelCase					:		Optional[int]		   =     do_lower_case
																				__lowerCamelCase					:		Union[str, Any]		   =     strip_accents
																				__lowerCamelCase					:		Optional[Any]		   =     tokenize_chinese_chars
																				__lowerCamelCase					:		Optional[Any]		   =     normalizer_class(**UpperCAmelCase    )

													__lowerCamelCase					:		List[Any]		   =     do_lower_case






						def       lowerCamelCase__     (       self      :			Union[str, Any]							,					UpperCAmelCase      :			Union[str, Any]							,					UpperCAmelCase      :			Tuple=None    ):
													__lowerCamelCase					:		List[Any]		   =     [self.cls_token_id] + token_ids_a + [self.sep_token_id]

													if token_ids_a:
																				output += token_ids_a + [self.sep_token_id]

													return output






						def       lowerCamelCase__     (       self      :			Dict							,					UpperCAmelCase      :			List[int]							,					UpperCAmelCase      :			Optional[List[int]] = None    ):
													__lowerCamelCase					:		Tuple		   =     [self.sep_token_id]
													__lowerCamelCase					:		int		   =     [self.cls_token_id]
													if token_ids_a is None:
																				return len(cls    ) * [self.cls_token_type_id] + len(token_ids_a + sep    ) * [0]
													return len(cls    ) * [self.cls_token_type_id] + len(token_ids_a + sep    ) * [0] + len(token_ids_a + sep    ) * [1]







						def       lowerCamelCase__     (       self      :			Tuple							,					UpperCAmelCase      :			str							,					UpperCAmelCase      :			Optional[str] = None    ):
													__lowerCamelCase					:		List[Any]		   =     self._tokenizer.model.save(UpperCAmelCase							,					name=UpperCAmelCase    )
													return tuple(UpperCAmelCase    )