"""simple docstring"""

from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


__lowercase    =				logging.get_logger(__name__)






class 		_lowercase (						__a      ):



						"""simple docstring"""




						lowercase__       =  ['''input_ids''', '''attention_mask''']





						def __init__(				self							:    int     , UpperCamelCase__							:    List[Any]="[PAD]"     , UpperCamelCase__							:    Optional[Any]="[BOS]"     , UpperCamelCase__							:    str="[EOS]"     , UpperCamelCase__							:    Tuple="[MASK]"     , UpperCamelCase__							:    Tuple="[CLS]"     , UpperCamelCase__							:    int="[SEP]"     , UpperCamelCase__							:    List[Any]=2048     , **UpperCamelCase__							:    List[Any]     , )				->				None:
													'''simple docstring'''



													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else pad_token
													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else bos_token
													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else eos_token
													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else mask_token
													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else cls_token
													__UpperCamelCase							=AddedToken(UpperCamelCase__     , lstrip=UpperCamelCase__     , rstrip=UpperCamelCase__				) if isinstance(UpperCamelCase__     , UpperCamelCase__				) else sep_token

													super().__init__(
													    pad_token=UpperCamelCase__     , bos_token=UpperCamelCase__     , eos_token=UpperCamelCase__     , mask_token=UpperCamelCase__     , cls_token=UpperCamelCase__     , sep_token=UpperCamelCase__     , model_max_length=UpperCamelCase__     , **UpperCamelCase__     , )

													__UpperCamelCase							=2**8  # utf is 8 bits

													# define special tokens dict
													__UpperCamelCase							={
													    self.pad_token: 0,
													    self.bos_token: 1,
													    self.eos_token: 2,
													    self.mask_token: 3,
													    self.cls_token: 4,
													    self.sep_token: 5,
													}
													__UpperCamelCase							=len(self.special_tokens_encoder				)
													__UpperCamelCase							={v: k for k, v in self.special_tokens_encoder.items()}





						def   UpperCAmelCase_ (				self							:    Union[str, Any]				)				->				Dict[str, int]:
													'''simple docstring'''



													__UpperCamelCase							=self.special_tokens_encoder.copy()
													vocab.update(self.added_tokens_encoder				)
													for i in range(self._utf_vocab_size				):
																				__UpperCamelCase							=chr(UpperCamelCase__				)
																				__UpperCamelCase							=i + len(self.special_tokens_encoder				)
													return vocab





						@property
						def   UpperCAmelCase_ (				self							:    List[str]				)				->				int:
													'''simple docstring'''



													return self._utf_vocab_size + self._num_special_tokens





						def   UpperCAmelCase_ (				self							:    Optional[Any]     , UpperCamelCase__							:    List[int]     , UpperCamelCase__							:    Optional[List[int]] = None     , UpperCamelCase__							:    bool = False				)				->				List[int]:
													'''simple docstring'''



													if already_has_special_tokens:
																				return super().get_special_tokens_mask(
																				    token_ids_a=UpperCamelCase__     , token_ids_a=UpperCamelCase__     , already_has_special_tokens=UpperCamelCase__				)

													# normal case: some special tokens
													if token_ids_a is None:
																				return [1] + [0] * len(UpperCamelCase__				) + [1]
													return [1] + ([0] * len(UpperCamelCase__				)) + [1] + ([0] * len(UpperCamelCase__				)) + [1]





						def   UpperCAmelCase_ (				self							:    int     , UpperCamelCase__							:    List[int]     , UpperCamelCase__							:    Optional[List[int]] = None				)				->				List[int]:
													'''simple docstring'''



													if token_ids_a is None:
																				return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
													else:
																				return [self.cls_token_id] + token_ids_a + [self.sep_token_id] + token_ids_a + [self.sep_token_id]





						def   UpperCAmelCase_ (				self							:    Dict     , UpperCamelCase__							:    str				)				->				List[str]:
													'''simple docstring'''



													__UpperCamelCase							=[chr(UpperCamelCase__				) for i in text.encode('''utf-8'''				)]
													return tokens





						def   UpperCAmelCase_ (				self							:    int     , UpperCamelCase__							:    List[str]				)				->				Union[str, Any]:
													'''simple docstring'''



													if token in self.special_tokens_encoder:
																				__UpperCamelCase							=self.special_tokens_encoder[token]
													elif token in self.added_tokens_encoder:
																				__UpperCamelCase							=self.added_tokens_encoder[token]
													elif len(UpperCamelCase__				) != 1:
																				__UpperCamelCase							=self.unk_token_id
													else:
																				__UpperCamelCase							=ord(UpperCamelCase__				) + self._num_special_tokens
													return token_id





						def   UpperCAmelCase_ (				self							:    int     , UpperCamelCase__							:    Optional[int]				)				->				Optional[Any]:
													'''simple docstring'''



													if index in self.special_tokens_decoder:
																				__UpperCamelCase							=self.special_tokens_decoder[index]
													elif index in self.added_tokens_decoder:
																				__UpperCamelCase							=self.added_tokens_decoder[index]
													else:
																				__UpperCamelCase							=chr(index - self._num_special_tokens				)
													return token





						def   UpperCAmelCase_ (				self							:    Optional[Any]     , UpperCamelCase__							:    Union[str, Any]				)				->				Optional[Any]:
													'''simple docstring'''



													__UpperCamelCase							=B''''''
													for token in tokens:
																				if token in self.special_tokens_decoder:
																											__UpperCamelCase							=self.special_tokens_decoder[token].encode('''utf-8'''				)
																				elif token in self.added_tokens_decoder:
																											__UpperCamelCase							=self.special_tokens_decoder[token].encode('''utf-8'''				)
																				elif token in self.special_tokens_encoder:
																											__UpperCamelCase							=token.encode('''utf-8'''				)
																				elif token in self.added_tokens_encoder:
																											__UpperCamelCase							=token.encode('''utf-8'''				)
																				else:
																											__UpperCamelCase							=bytes([ord(UpperCamelCase__				)]				)
																				bstring += tok_string
													__UpperCamelCase							=bstring.decode('''utf-8'''     , errors='''replace'''				)
													return string





						def   UpperCAmelCase_ (				self							:    Optional[Any]     , UpperCamelCase__							:    str     , UpperCamelCase__							:    Optional[str] = None				)				->				Tuple[str]:
													'''simple docstring'''



													return ()




"""simple docstring"""

from typing import TYPE_CHECKING

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


__lowercase    =				{
    '''configuration_videomae''': ['''VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VideoMAEConfig'''],
}

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

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__lowercase    =				['''VideoMAEFeatureExtractor''']
				__lowercase    =				['''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    =				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



