




import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						["image_processor", "tokenizer"]
     _a							 =						"CLIPImageProcessor"
     _a							 =						("CLIPTokenizer", "CLIPTokenizerFast")

     def __init__(  self		,     _a=None		,     _a=None		,     **_a				)						->							Dict:
           _A							:     Any			=						None
           if "feature_extractor" in kwargs:
                 warnings.warn(
                     """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
                     """ instead."""		,     _a		,     )
                 _A							:     Union[str, Any]			=						kwargs.pop("""feature_extractor"""				)

           _A							:     Optional[int]			=						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__(_a		,     _a				)

     def __call__(  self		,     _a=None		,     _a=None		,     _a=None		,     **_a				)						->							int:

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

           if text is not None:
                 _A							:     List[str]			=						self.tokenizer(_a		,     return_tensors=_a		,     **_a				)

           if images is not None:
                 _A							:     Dict			=						self.image_processor(_a		,     return_tensors=_a		,     **_a				)

           if text is not None and images is not None:
                 _A							:     Tuple			=						image_features.pixel_values
                 return encoding
           elif text is not None:
                 return encoding
           else:
                 return BatchEncoding(data=dict(**_a				)		,     tensor_type=_a				)

     def 					a__	(  self		,     *_a		,     **_a				)						->							List[Any]:
           return self.tokenizer.batch_decode(*_a		,     **_a				)

     def 					a__	(  self		,     *_a		,     **_a				)						->							Any:
           return self.tokenizer.decode(*_a		,     **_a				)

     @property
     def 					a__	(  self				)						->							List[Any]:
           _A							:     Union[str, Any]			=						self.tokenizer.model_input_names
           _A							:     str			=						self.image_processor.model_input_names
           return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names				)				)

     @property
     def 					a__	(  self				)						->							List[str]:
           warnings.warn(
               """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""		,     _a		,     )
           return self.image_processor_class



     @property
     def 					a__	(  self				)						->							List[Any]:
           warnings.warn(
               """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""		,     _a		,     )
           return self.image_processor







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


_snake_case										=       logging.get_logger(__name__)

_snake_case										=       {
    "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json",
    "google/fnet-large": "https://huggingface.co/google/fnet-large/resolve/main/config.json"
    # See all FNet models at https://huggingface.co/models?filter=fnet
}







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						"fnet"

     def __init__(  self		,     _a=3_2000		,     _a=768		,     _a=12		,     _a=3072		,     _a="gelu_new"		,     _a=0.1		,     _a=512		,     _a=4		,     _a=0.02		,     _a=1e-12		,     _a=False		,     _a=512		,     _a=3		,     _a=1		,     _a=2		,     **_a		,     )						->							int:
           super().__init__(pad_token_id=_a		,     bos_token_id=_a		,     eos_token_id=_a		,     **_a				)

           _A							:     Any			=						vocab_size
           _A							:     str			=						max_position_embeddings
           _A							:     Optional[Any]			=						hidden_size
           _A							:     List[str]			=						num_hidden_layers
           _A							:     List[str]			=						intermediate_size
           _A							:     List[Any]			=						hidden_act
           _A							:     List[str]			=						hidden_dropout_prob
           _A							:     List[str]			=						initializer_range
           _A							:     List[Any]			=						type_vocab_size
           _A							:     List[Any]			=						layer_norm_eps
           _A							:     List[str]			=						use_tpu_fourier_optimizations
           _A							:     str			=						tpu_short_seq_length

