


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


SCREAMING_SNAKE_CASE :   Optional[Any]							      =				logging.get_logger(__name__)

SCREAMING_SNAKE_CASE :   int							      =				{
    "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json",
}






class _lowerCamelCase(		_a     ):
       lowercase_				:			Optional[int]									=    """lxmert"""
       lowercase_				:			Dict									=    {}
       def __init__(      self,   lowerCamelCase=3_05_22,   lowerCamelCase=7_68,   lowerCamelCase=12,   lowerCamelCase=95_00,   lowerCamelCase=16_00,   lowerCamelCase=4_00,   lowerCamelCase=30_72,   lowerCamelCase="gelu",   lowerCamelCase=0.1,   lowerCamelCase=0.1,   lowerCamelCase=5_12,   lowerCamelCase=2,   lowerCamelCase=0.0_2,   lowerCamelCase=1E-12,   lowerCamelCase=9,   lowerCamelCase=5,   lowerCamelCase=5,   lowerCamelCase=20_48,   lowerCamelCase=4,   lowerCamelCase=6.6_7,   lowerCamelCase=True,   lowerCamelCase=True,   lowerCamelCase=True,   lowerCamelCase=True,   lowerCamelCase=True,   lowerCamelCase=True,   lowerCamelCase=True,   **lowerCamelCase,   ) ->     Any:




           """simple docstring"""

           _lowercase :							Tuple   	=	vocab_size
           _lowercase :							str   	=	hidden_size
           _lowercase :							Any   	=	num_attention_heads
           _lowercase :							Union[str, Any]   	=	hidden_act
           _lowercase :							Dict   	=	intermediate_size
           _lowercase :							Union[str, Any]   	=	hidden_dropout_prob
           _lowercase :							Any   	=	attention_probs_dropout_prob
           _lowercase :							List[str]   	=	max_position_embeddings
           _lowercase :							Optional[Any]   	=	type_vocab_size
           _lowercase :							List[str]   	=	initializer_range
           _lowercase :							Any   	=	layer_norm_eps
           _lowercase :							List[Any]   	=	num_qa_labels
           _lowercase :							Union[str, Any]   	=	num_object_labels
           _lowercase :							Dict   	=	num_attr_labels
           _lowercase :							Dict   	=	l_layers
           _lowercase :							int   	=	x_layers
           _lowercase :							Tuple   	=	r_layers
           _lowercase :							Union[str, Any]   	=	visual_feat_dim
           _lowercase :							Optional[Any]   	=	visual_pos_dim
           _lowercase :							List[str]   	=	visual_loss_normalizer
           _lowercase :							Dict   	=	task_matched
           _lowercase :							Optional[Any]   	=	task_mask_lm
           _lowercase :							Any   	=	task_obj_predict
           _lowercase :							Dict   	=	task_qa
           _lowercase :							Optional[int]   	=	visual_obj_loss
           _lowercase :							Optional[Any]   	=	visual_attr_loss
           _lowercase :							Union[str, Any]   	=	visual_feat_loss
           _lowercase :							Optional[int]   	=	{'vision': r_layers, 'cross_encoder': x_layers, 'language': l_layers}
           super().__init__(**lowerCamelCase)






from typing import Dict

from .base import GenericTensor, Pipeline






class _lowerCamelCase(		_a     ):
       def     UpperCamelCase  (      self,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=None,   **lowerCamelCase) ->     int:




           """simple docstring"""

           if tokenize_kwargs is None:
               _lowercase :							Any   	=	{}

           if truncation is not None:
               if "truncation" in tokenize_kwargs:
                   raise ValueError(
                       'truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)')
               _lowercase :							List[Any]   	=	truncation

           _lowercase :							Optional[Any]   	=	tokenize_kwargs

           _lowercase :							Tuple   	=	{}
           if return_tensors is not None:
               _lowercase :							Union[str, Any]   	=	return_tensors

           return preprocess_params, {}, postprocess_params
       def     UpperCamelCase  (      self,   lowerCamelCase,   **lowerCamelCase) ->     Dict[str, GenericTensor]:




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	self.framework
           _lowercase :							Dict   	=	self.tokenizer(lowerCamelCase,   return_tensors=lowerCamelCase,   **lowerCamelCase)
           return model_inputs
       def     UpperCamelCase  (      self,   lowerCamelCase) ->     Optional[Any]:




           """simple docstring"""

           _lowercase :							str   	=	self.model(**lowerCamelCase)
           return model_outputs
       def     UpperCamelCase  (      self,   lowerCamelCase,   lowerCamelCase=False) ->     Dict:




           """simple docstring"""

           if return_tensors:
               return model_outputs[0]
           if self.framework == "pt":
               return model_outputs[0].tolist()
           elif self.framework == "tf":
               return model_outputs[0].numpy().tolist()




       def __call__(      self,   *lowerCamelCase,   **lowerCamelCase) ->     Union[str, Any]:




           """simple docstring"""

           return super().__call__(*lowerCamelCase,   **lowerCamelCase)


