




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__							( UpperCAmelCase__		,      unittest.TestCase       ):






				'''simple docstring'''
				__UpperCamelCase    						=		CpmAntTokenizer
				__UpperCamelCase    						=		False





				def      _lowerCAmelCase       ( self				):





							"""simple docstring"""
							super().setUp()

							lowerCamelCase       =      [
							    """<d>""",
							    """</d>""",
							    """<s>""",
							    """</s>""",
							    """</_>""",
							    """<unk>""",
							    """<pad>""",
							    """</n>""",
							    """我""",
							    """是""",
							    """C""",
							    """P""",
							    """M""",
							    """A""",
							    """n""",
							    """t""",
							]
							lowerCamelCase       =      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      _lowerCAmelCase       ( self				):





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

							lowerCamelCase       =      [6, 9_802, 14_962, 2_082, 831, 244]
							self.assertListEqual(tokenizer.convert_tokens_to_ids(_a				)	,				_a				)

							lowerCamelCase       =      tokenizer.decode(_a				)
							self.assertEqual(_a	,				_a				)









"""simple docstring"""




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


lowerCAmelCase							:    Dict  							=							logging.get_logger(__name__)

lowerCAmelCase							:    Optional[Any]  							=							{
    """MIT/ast-finetuned-audioset-10-10-0.4593""": (
        """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json"""
    ),
}






class 					__magic_name__							( UpperCAmelCase__       ):






				'''simple docstring'''
				__UpperCamelCase    						=		"audio-spectrogram-transformer"





				def __init__( self	,				_a=768	,				_a=12	,				_a=12	,				_a=3_072	,				_a="gelu"	,				_a=0.0	,				_a=0.0	,				_a=0.02	,				_a=1e-1_2	,				_a=16	,				_a=True	,				_a=10	,				_a=10	,				_a=1_024	,				_a=128	,				**_a	,				):





							"""simple docstring"""
							super().__init__(**_a				)

							lowerCamelCase       =      hidden_size
							lowerCamelCase       =      num_hidden_layers
							lowerCamelCase       =      num_attention_heads
							lowerCamelCase       =      intermediate_size
							lowerCamelCase       =      hidden_act
							lowerCamelCase       =      hidden_dropout_prob
							lowerCamelCase       =      attention_probs_dropout_prob
							lowerCamelCase       =      initializer_range
							lowerCamelCase       =      layer_norm_eps
							lowerCamelCase       =      patch_size
							lowerCamelCase       =      qkv_bias
							lowerCamelCase       =      frequency_stride
							lowerCamelCase       =      time_stride
							lowerCamelCase       =      max_length
							lowerCamelCase       =      num_mel_bins



