






"""simple docstring"""






from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


A_			  =    logging.get_logger(__name__)

A_			  =    {
    "flaubert/flaubert_small_cased": "https://huggingface.co/flaubert/flaubert_small_cased/resolve/main/config.json",
    "flaubert/flaubert_base_uncased": "https://huggingface.co/flaubert/flaubert_base_uncased/resolve/main/config.json",
    "flaubert/flaubert_base_cased": "https://huggingface.co/flaubert/flaubert_base_cased/resolve/main/config.json",
    "flaubert/flaubert_large_cased": "https://huggingface.co/flaubert/flaubert_large_cased/resolve/main/config.json",
}
class 						__lowerCAmelCase   (			UpperCAmelCase       ):







  '''simple docstring'''


  __lowerCamelCase       :    Any     	=			"flaubert"
  __lowerCamelCase       :    Union[str, Any]     	=			{
      "hidden_size": "emb_dim",
      "num_attention_heads": "n_heads",
      "num_hidden_layers": "n_layers",
      "n_words": "vocab_size",  # For backward compatibility
  }
  def __init__(      self:		str				,			UpperCamelCase_:		Dict=False				,			UpperCamelCase_:		Optional[int]=0.0				,			UpperCamelCase_:		Union[str, Any]=3_0145				,			UpperCamelCase_:		List[Any]=2048				,			UpperCamelCase_:		Optional[int]=12				,			UpperCamelCase_:		List[str]=16				,			UpperCamelCase_:		Optional[Any]=0.1				,			UpperCamelCase_:		List[str]=0.1				,			UpperCamelCase_:		Tuple=True				,			UpperCamelCase_:		Any=False				,			UpperCamelCase_:		Union[str, Any]=False				,			UpperCamelCase_:		int=False				,			UpperCamelCase_:		int=1				,			UpperCamelCase_:		str=True				,			UpperCamelCase_:		Optional[int]=512				,			UpperCamelCase_:		Optional[int]=2048**-0.5				,			UpperCamelCase_:		List[Any]=1e-1_2				,			UpperCamelCase_:		Tuple=0.02				,			UpperCamelCase_:		List[Any]=0				,			UpperCamelCase_:		List[str]=1				,			UpperCamelCase_:		List[str]=2				,			UpperCamelCase_:		Optional[Any]=3				,			UpperCamelCase_:		Optional[Any]=5				,			UpperCamelCase_:		List[Any]=True				,			UpperCamelCase_:		Tuple="first"				,			UpperCamelCase_:		str=True				,			UpperCamelCase_:		List[Any]=None				,			UpperCamelCase_:		Any=True				,			UpperCamelCase_:		Optional[int]=0.1				,			UpperCamelCase_:		Union[str, Any]=5				,			UpperCamelCase_:		List[str]=5				,			UpperCamelCase_:		str=0				,			UpperCamelCase_:		List[str]=0				,			UpperCamelCase_:		Tuple=2				,			UpperCamelCase_:		Union[str, Any]=0				,			**UpperCamelCase_:		str				,			):
     UpperCamelCase_     =pre_norm
     UpperCamelCase_     =layerdrop
     UpperCamelCase_     =vocab_size
     UpperCamelCase_     =emb_dim
     UpperCamelCase_     =n_layers
     UpperCamelCase_     =n_heads
     UpperCamelCase_     =dropout
     UpperCamelCase_     =attention_dropout
     UpperCamelCase_     =gelu_activation
     UpperCamelCase_     =sinusoidal_embeddings
     UpperCamelCase_     =causal
     UpperCamelCase_     =asm
     UpperCamelCase_     =n_langs
     UpperCamelCase_     =use_lang_emb
     UpperCamelCase_     =layer_norm_eps
     UpperCamelCase_     =bos_index
     UpperCamelCase_     =eos_index
     UpperCamelCase_     =pad_index
     UpperCamelCase_     =unk_index
     UpperCamelCase_     =mask_index
     UpperCamelCase_     =is_encoder
     UpperCamelCase_     =max_position_embeddings
     UpperCamelCase_     =embed_init_std
     UpperCamelCase_     =init_std
     UpperCamelCase_     =summary_type
     UpperCamelCase_     =summary_use_proj
     UpperCamelCase_     =summary_activation
     UpperCamelCase_     =summary_proj_to_labels
     UpperCamelCase_     =summary_first_dropout
     UpperCamelCase_     =start_n_top
     UpperCamelCase_     =end_n_top
     UpperCamelCase_     =mask_token_id
     UpperCamelCase_     =lang_id

     if "n_words" in kwargs:
        UpperCamelCase_     =kwargs["n_words"]

     super().__init__(pad_token_id=UpperCamelCase_				,			bos_token_id=UpperCamelCase_				,			**UpperCamelCase_					)




class 						__lowerCAmelCase   (			UpperCAmelCase       ):







  '''simple docstring'''


  @property
  def 					UpperCamelCase__   (      self:		Union[str, Any]					):
     if self.task == "multiple-choice":
        UpperCamelCase_     ={0: "batch", 1: "choice", 2: "sequence"}
     else:
        UpperCamelCase_     ={0: "batch", 1: "sequence"}
     return OrderedDict(
         [
             ("input_ids", dynamic_axis),
             ("attention_mask", dynamic_axis),
         ]					)








"""simple docstring"""






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class 						__lowerCAmelCase   (			UpperCAmelCase       ):







  '''simple docstring'''


  __lowerCamelCase       :    Optional[Any]     	=			["image_processor", "tokenizer"]
  __lowerCamelCase       :    List[str]     	=			"VideoMAEImageProcessor"
  __lowerCamelCase       :    Dict     	=			("CLIPTokenizer", "CLIPTokenizerFast")
  def __init__(      self:		str				,			UpperCamelCase_:		Dict=None				,			UpperCamelCase_:		str=None				,			**UpperCamelCase_:		str					):
     UpperCamelCase_     =None
     if "feature_extractor" in kwargs:
        warnings.warn(
            "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
            " instead."				,			UpperCamelCase_				,			)
        UpperCamelCase_     =kwargs.pop("feature_extractor"					)

     UpperCamelCase_     =image_processor if image_processor is not None else feature_extractor
     if image_processor is None:
        raise ValueError("You need to specify an `image_processor`."					)
     if tokenizer is None:
        raise ValueError("You need to specify a `tokenizer`."					)

     super().__init__(UpperCamelCase_				,			UpperCamelCase_					)
     UpperCamelCase_     =self.image_processor
  def __call__(      self:		Tuple				,			UpperCamelCase_:		str=None				,			UpperCamelCase_:		str=None				,			UpperCamelCase_:		Optional[Any]=None				,			**UpperCamelCase_:		int					):

     if text is None and videos is None:
        raise ValueError("You have to specify either text or videos. Both cannot be none."					)

     if text is not None:
        UpperCamelCase_     =self.tokenizer(UpperCamelCase_				,			return_tensors=UpperCamelCase_				,			**UpperCamelCase_					)

     if videos is not None:
        UpperCamelCase_     =self.image_processor(UpperCamelCase_				,			return_tensors=UpperCamelCase_				,			**UpperCamelCase_					)

     if text is not None and videos is not None:
        UpperCamelCase_     =image_features.pixel_values
        return encoding
     elif text is not None:
        return encoding
     else:
        return BatchEncoding(data=dict(**UpperCamelCase_					)				,			tensor_type=UpperCamelCase_					)
  def 					UpperCamelCase__   (      self:		Any				,			*UpperCamelCase_:		List[str]				,			**UpperCamelCase_:		Optional[int]					):
     return self.tokenizer.batch_decode(*UpperCamelCase_				,			**UpperCamelCase_					)
  def 					UpperCamelCase__   (      self:		Optional[Any]				,			*UpperCamelCase_:		List[str]				,			**UpperCamelCase_:		Tuple					):
     return self.tokenizer.decode(*UpperCamelCase_				,			**UpperCamelCase_					)
  @property
  def 					UpperCamelCase__   (      self:		List[Any]					):
     return ["input_ids", "attention_mask", "position_ids", "pixel_values"]
  @property
  def 					UpperCamelCase__   (      self:		str					):
     warnings.warn(
         "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."				,			UpperCamelCase_				,			)
     return self.image_processor_class





  @property
  def 					UpperCamelCase__   (      self:		Optional[Any]					):
     warnings.warn(
         "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."				,			UpperCamelCase_				,			)
     return self.image_processor
