




import os
import tempfile
import unittest
from typing import List

from transformers.models.esm.tokenization_esm import VOCAB_FILES_NAMES, EsmTokenizer
from transformers.testing_utils import require_tokenizers
from transformers.tokenization_utils import PreTrainedTokenizer
from transformers.tokenization_utils_base import PreTrainedTokenizerBase






@require_tokenizers
class    __lowerCAmelCase			(	unittest.TestCase			):
			snake_case_				:			Union[str, Any]								=					EsmTokenizer







			def UpperCamelCase      (	self   :      Any				):




									"""simple docstring"""


									super().setUp()
									_UpperCAmelCase													=					tempfile.mkdtemp()
									# fmt: off
									_UpperCAmelCase													=					["<cls>", "<pad>", "<eos>", "<unk>", "L", "A", "G", "V", "S", "E", "R", "T", "I", "D", "P", "K", "Q", "N", "F", "Y", "M", "H", "W", "C", "X", "B", "U", "Z", "O", ".", "-", "<null_1>", "<mask>"]  # noqa: E501
									# fmt: on
									_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]				)				)







			def UpperCamelCase      (	self   :      List[Any]   ,   **snake_case__   :      List[Any]				):




									"""simple docstring"""


									return [self.get_tokenizer(**snake_case__				)]







			def UpperCamelCase      (	self   :      Any   ,   **snake_case__   :      Optional[int]				):




									"""simple docstring"""


									return self.tokenizer_class.from_pretrained(self.tmpdirname   ,   **snake_case__				)







			def UpperCamelCase      (	self   :      str				):




									"""simple docstring"""


									_UpperCAmelCase													=					self.tokenizer_class(self.vocab_file				)

									_UpperCAmelCase													=					tokenizer.tokenize("LAGVS"				)
									self.assertListEqual(snake_case__   ,   ["L", "A", "G", "V", "S"]				)
									self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case__				)   ,   [4, 5, 6, 7, 8]				)







			def UpperCamelCase      (	self   :      List[Any]				):




									"""simple docstring"""


									_UpperCAmelCase													=					self.tokenizer_class(self.vocab_file				)

									_UpperCAmelCase													=					"LAGVS"
									self.assertListEqual(tokenizer.encode(snake_case__				)   ,   [0, 4, 5, 6, 7, 8, 2]				)







			def UpperCamelCase      (	self   :      Tuple				):




									"""simple docstring"""


									_UpperCAmelCase													=					self.tokenizer_class(self.vocab_file				)

									_UpperCAmelCase													=					["LAGVS", "WCB"]
									_UpperCAmelCase													=					tokenizer(snake_case__   ,   padding=snake_case__				)["input_ids"]

									self.assertListEqual(snake_case__   ,   [[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2]]				)







			def UpperCamelCase      (	self   :      List[Any]				):




									"""simple docstring"""


									_UpperCAmelCase													=					self.tokenizer_class(self.vocab_file				)

									_UpperCAmelCase													=					["LAGVS", "WCB"]
									_UpperCAmelCase													=					tokenizer(snake_case__   ,   padding=snake_case__				)["input_ids"]

									self.assertListEqual(snake_case__   ,   [[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2, 1, 1]]				)







			def UpperCamelCase      (	self   :      Optional[int]				):




									"""simple docstring"""


									_UpperCAmelCase													=					self.get_tokenizers(fast=snake_case__				)
									for tokenizer in tokenizers:
															with self.subTest(F"""{tokenizer.__class__.__name__}"""				):
																					_UpperCAmelCase													=					"<unk>"
																					_UpperCAmelCase													=					"<mask>"

																					_UpperCAmelCase													=					tokenizer.tokenize(snake_case__				)
																					_UpperCAmelCase													=					tokenizer.tokenize(snake_case__				)

																					self.assertEqual(len(snake_case__				)   ,   1				)
																					self.assertEqual(len(snake_case__				)   ,   1				)
																					self.assertEqual(token_a[0]   ,   snake_case__				)
																					self.assertEqual(token_a[0]   ,   snake_case__				)












from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowercase_     :    int      =			{
    'configuration_videomae': ['VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VideoMAEConfig'],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowercase_     :    List[str]      =			[
				    'VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'VideoMAEForPreTraining',
				    'VideoMAEModel',
				    'VideoMAEPreTrainedModel',
				    'VideoMAEForVideoClassification',
				]

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowercase_     :    Any      =			['VideoMAEFeatureExtractor']
				lowercase_     :    Dict      =			['VideoMAEImageProcessor']

if TYPE_CHECKING:
				from .configuration_videomae import VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP, VideoMAEConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_videomae import (
								    VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST,
								    VideoMAEForPreTraining,
								    VideoMAEForVideoClassification,
								    VideoMAEModel,
								    VideoMAEPreTrainedModel,
								)

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_videomae import VideoMAEFeatureExtractor
								from .image_processing_videomae import VideoMAEImageProcessor

else:
				import sys

				lowercase_     :    int      =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




