



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


__lowerCamelCase     :							Optional[Any]  							=				logging.get_logger(__name__)

__lowerCamelCase     :							Union[str, Any]  							=				{
    "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json",
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}





class  __magic_name__   (							A__						):
		lowercase      :       List[Any]          ='''cvt'''






		def __init__(						self      :     List[Any]				,		UpperCamelCase__      :     Union[str, Any]=3				,		UpperCamelCase__      :     List[str]=[7, 3, 3]				,		UpperCamelCase__      :     List[Any]=[4, 2, 2]				,		UpperCamelCase__      :     Optional[int]=[2, 1, 1]				,		UpperCamelCase__      :     Tuple=[64, 1_92, 3_84]				,		UpperCamelCase__      :     Dict=[1, 3, 6]				,		UpperCamelCase__      :     Optional[Any]=[1, 2, 10]				,		UpperCamelCase__      :     Any=[4.0, 4.0, 4.0]				,		UpperCamelCase__      :     List[str]=[0.0, 0.0, 0.0]				,		UpperCamelCase__      :     int=[0.0, 0.0, 0.0]				,		UpperCamelCase__      :     Optional[Any]=[0.0, 0.0, 0.1]				,		UpperCamelCase__      :     Any=[True, True, True]				,		UpperCamelCase__      :     Optional[int]=[False, False, True]				,		UpperCamelCase__      :     Tuple=["dw_bn", "dw_bn", "dw_bn"]				,		UpperCamelCase__      :     List[str]=[3, 3, 3]				,		UpperCamelCase__      :     Optional[int]=[1, 1, 1]				,		UpperCamelCase__      :     Tuple=[2, 2, 2]				,		UpperCamelCase__      :     Tuple=[1, 1, 1]				,		UpperCamelCase__      :     List[str]=[1, 1, 1]				,		UpperCamelCase__      :     Optional[int]=0.02				,		UpperCamelCase__      :     Optional[Any]=1e-1_2				,		**UpperCamelCase__      :     Optional[Any]				,		)				->					List[Any]:
								'''simple docstring'''







								super().__init__(**UpperCamelCase__      )
								UpperCAmelCase         =     num_channels
								UpperCAmelCase         =     patch_sizes
								UpperCAmelCase         =     patch_stride
								UpperCAmelCase         =     patch_padding
								UpperCAmelCase         =     embed_dim
								UpperCAmelCase         =     num_heads
								UpperCAmelCase         =     depth
								UpperCAmelCase         =     mlp_ratio
								UpperCAmelCase         =     attention_drop_rate
								UpperCAmelCase         =     drop_rate
								UpperCAmelCase         =     drop_path_rate
								UpperCAmelCase         =     qkv_bias
								UpperCAmelCase         =     cls_token
								UpperCAmelCase         =     qkv_projection_method
								UpperCAmelCase         =     kernel_qkv
								UpperCAmelCase         =     padding_kv
								UpperCAmelCase         =     stride_kv
								UpperCAmelCase         =     padding_q
								UpperCAmelCase         =     stride_q
								UpperCAmelCase         =     initializer_range
								UpperCAmelCase         =     layer_norm_eps








import os
import unittest

from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer
from transformers.testing_utils import require_jieba, tooslow

from ...test_tokenization_common import TokenizerTesterMixin





@require_jieba
class  __magic_name__   (							A__,  unittest.TestCase						):
		lowercase      :       Optional[Any]          =CpmAntTokenizer
		lowercase      :       Dict          =False






		def SCREAMING_SNAKE_CASE_			(						self      :     Optional[Any]      )				->					Dict:
								'''simple docstring'''







								super().setUp()

								UpperCAmelCase         =     [
								    "<d>",
								    "</d>",
								    "<s>",
								    "</s>",
								    "</_>",
								    "<unk>",
								    "<pad>",
								    "</n>",
								    "我",
								    "是",
								    "C",
								    "P",
								    "M",
								    "A",
								    "n",
								    "t",
								]
								UpperCAmelCase         =     os.path.join(self.tmpdirname				,		VOCAB_FILES_NAMES["vocab_file"]      )
								with open(self.vocab_file				,		"w"				,		encoding="utf-8"      ) as vocab_writer:
														vocab_writer.write("".join([x + "\n" for x in vocab_tokens]      )      )







		@tooslow
		def SCREAMING_SNAKE_CASE_			(						self      :     List[str]      )				->					Dict:
								'''simple docstring'''







								UpperCAmelCase         =     CpmAntTokenizer.from_pretrained("openbmb/cpm-ant-10b"      )
								UpperCAmelCase         =     "今天天气真好！"
								UpperCAmelCase         =     ["今天", "天气", "真", "好", "！"]
								UpperCAmelCase         =     tokenizer.tokenize(UpperCamelCase__      )
								self.assertListEqual(UpperCamelCase__				,		UpperCamelCase__      )
								UpperCAmelCase         =     "今天天气真好！"
								UpperCAmelCase         =     [tokenizer.bos_token] + tokens

								UpperCAmelCase         =     [6, 98_02, 1_49_62, 20_82, 8_31, 2_44]
								self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCamelCase__      )				,		UpperCamelCase__      )

								UpperCAmelCase         =     tokenizer.decode(UpperCamelCase__      )
								self.assertEqual(UpperCamelCase__				,		UpperCamelCase__      )



