
'''simple docstring'''





from typing import List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_clip import CLIPTokenizer


A							     = logging.get_logger(__name__)

A							     = {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}

A							     = {
    "vocab_file": {
        "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json",
    },
    "merges_file": {
        "openai/clip-vit-base-patch32": "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt",
    },
    "tokenizer_file": {
        "openai/clip-vit-base-patch32": (
            "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json"
        ),
    },
}

A							     = {
    "openai/clip-vit-base-patch32": 7_7,
}



class 			lowerCAmelCase__ (							UpperCamelCase							):



  '''simple docstring'''






  _UpperCamelCase							=			VOCAB_FILES_NAMES
  _UpperCamelCase							=			PRETRAINED_VOCAB_FILES_MAP
  _UpperCamelCase							=			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  _UpperCamelCase							=			['input_ids', 'attention_mask']
  _UpperCamelCase							=			CLIPTokenizer

  def __init__(self	:			Dict						,			lowerCAmelCase_	:			Any=None						,			lowerCAmelCase_	:			List[Any]=None						,			lowerCAmelCase_	:			Dict=None						,			lowerCAmelCase_	:			Union[str, Any]="<|endoftext|>"						,			lowerCAmelCase_	:			Union[str, Any]="<|startoftext|>"						,			lowerCAmelCase_	:			Optional[int]="<|endoftext|>"						,			lowerCAmelCase_	:			int="<|endoftext|>"						,			**lowerCAmelCase_	:			Union[str, Any]						,			) ->							Tuple:
        super().__init__(
            lowerCAmelCase_						,			lowerCAmelCase_						,			tokenizer_file=lowerCAmelCase_						,			unk_token=lowerCAmelCase_						,			bos_token=lowerCAmelCase_						,			eos_token=lowerCAmelCase_						,			pad_token=lowerCAmelCase_						,			**lowerCAmelCase_						,			)

        if not isinstance(self.backend_tokenizer.pre_tokenizer						,			pre_tokenizers.Sequence     ):
              raise ValueError(
                  "The `backend_tokenizer` provided does not match the expected format. The CLIP tokenizer has been"
                  " heavily modified from transformers version 4.17.0. You need to convert the tokenizer you are using"
                  " to be compatible with this version.The easiest way to do so is"
                  " `CLIPTokenizerFast.from_pretrained(\"path_to_local_folder_or_hub_repo, from_slow=True)`. If you want"
                  " to use your existing tokenizer, you will have to revert to a version prior to 4.17.0 of"
                  " transformers."     )

        self._wrap_decode_method_backend_tokenizer()

  def 		_lowerCamelCase						(self	:			Optional[int]     ) ->							Optional[Any]:
        snake_case_    							=				self.backend_tokenizer.decode

        def new_decode_method(*lowerCAmelCase_	:			Any						,			**lowerCAmelCase_	:			Any     ):
              snake_case_    							=				orig_decode_method(*lowerCAmelCase_						,			**lowerCAmelCase_     )
              snake_case_    							=				text.replace(self.backend_tokenizer.model.end_of_word_suffix						,			" "     ).strip()
              return text

        snake_case_    							=				new_decode_method

  def 		_lowerCamelCase						(self	:			List[Any]						,			lowerCAmelCase_	:			List[int]						,			lowerCAmelCase_	:			Optional[List[int]] = None     ) ->							List[int]:
        snake_case_    							=				[self.bos_token_id]
        snake_case_    							=				[self.eos_token_id]

        if token_ids_a is None:
              return bos_token + token_ids_a + eos_token
        return bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token

  def 		_lowerCamelCase						(self	:			str						,			lowerCAmelCase_	:			List[int]						,			lowerCAmelCase_	:			Optional[List[int]] = None     ) ->							List[int]:
        snake_case_    							=				[self.bos_token_id]
        snake_case_    							=				[self.eos_token_id]

        if token_ids_a is None:
              return len(bos_token + token_ids_a + eos_token     ) * [0]
        return len(bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token     ) * [0]


  def 		_lowerCamelCase						(self	:			Optional[int]						,			lowerCAmelCase_	:			str						,			lowerCAmelCase_	:			Optional[str] = None     ) ->							Tuple[str]:
        snake_case_    							=				self._tokenizer.model.save(lowerCAmelCase_						,			name=lowerCAmelCase_     )
        return tuple(lowerCAmelCase_     )






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


snake_case     :    Any						=    logging.get_logger(__name__)

snake_case     :    List[str]						=    {
    'MCG-NJU/videomae-base': 'https://huggingface.co/MCG-NJU/videomae-base/resolve/main/config.json',
}




class 				lowerCAmelCase__	(						UpperCamelCase    ):
					__A  :     str     =    'videomae'







					def __init__(							self   :  Optional[Any]      ,		_A   :  str=224      ,		_A   :  Union[str, Any]=16      ,		_A   :  int=3      ,		_A   :  Tuple=16      ,		_A   :  int=2      ,		_A   :  List[Any]=768      ,		_A   :  List[Any]=12      ,		_A   :  Tuple=12      ,		_A   :  List[Any]=3072      ,		_A   :  Union[str, Any]="gelu"      ,		_A   :  Any=0.0      ,		_A   :  str=0.0      ,		_A   :  Tuple=0.02      ,		_A   :  Optional[Any]=1e-12      ,		_A   :  Tuple=True      ,		_A   :  Dict=True      ,		_A   :  str=6      ,		_A   :  Optional[int]=384      ,		_A   :  Any=4      ,		_A   :  Any=1536      ,		_A   :  Optional[int]=True      ,		**_A   :  Tuple      ,		):
											super().__init__(**_A)

											A__						:				List[str]         =			image_size
											A__						:				Union[str, Any]         =			patch_size
											A__						:				Optional[int]         =			num_channels
											A__						:				int         =			num_frames
											A__						:				List[Any]         =			tubelet_size

											A__						:				str         =			hidden_size
											A__						:				Optional[Any]         =			num_hidden_layers
											A__						:				int         =			num_attention_heads
											A__						:				List[Any]         =			intermediate_size
											A__						:				Optional[int]         =			hidden_act
											A__						:				Any         =			hidden_dropout_prob
											A__						:				str         =			attention_probs_dropout_prob
											A__						:				List[Any]         =			initializer_range
											A__						:				str         =			layer_norm_eps
											A__						:				Any         =			qkv_bias
											A__						:				Union[str, Any]         =			use_mean_pooling

											A__						:				int         =			decoder_num_attention_heads
											A__						:				Tuple         =			decoder_hidden_size
											A__						:				int         =			decoder_num_hidden_layers
											A__						:				int         =			decoder_intermediate_size
											A__						:				Any         =			norm_pix_loss