




import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel







class   A(						UpperCamelCase       ):



 '''simple docstring'''


 UpperCamelCase						       =						'''M-CLIP'''

 def __init__(    self :  Any						,							A_ :  Optional[Any]=1024						,							A_ :  Tuple=768						,							**A_ :  str  )       ->     Dict:

       """simple docstring"""






       lowerCamelCase_							=   transformerDimSize
       lowerCamelCase_							=   imageDimSize
       super().__init__(**A_  )







class   A(						UpperCamelCase       ):



 '''simple docstring'''


 UpperCamelCase						       =						MCLIPConfig

 def __init__(    self :  List[Any]						,							A_ :  Optional[Any]						,							*A_ :  Optional[Any]						,							**A_ :  Union[str, Any]  )       ->     Union[str, Any]:

       """simple docstring"""






       super().__init__(A_						,							*A_						,							**A_  )
       lowerCamelCase_							=   XLMRobertaModel(A_  )
       lowerCamelCase_							=   torch.nn.Linear(
           in_features=config.transformerDimensions						,							out_features=config.numDims  )





 def     a__			(    self :  List[Any]						,							A_ :  Tuple						,							A_ :  Union[str, Any]  )       ->     Dict:

       """simple docstring"""






       lowerCamelCase_							=   self.transformer(input_ids=A_						,							attention_mask=A_  )[0]
       lowerCamelCase_							=   (embs * attention_mask.unsqueeze(2  )).sum(dim=1  ) / attention_mask.sum(dim=1  )[:, None]
       return self.LinearTransformation(A_  ), embs









from ..utils import DummyObject, requires_backends







class   A(						metaclass=UpperCamelCase       ):



 '''simple docstring'''


 UpperCamelCase						       =						['''keras_nlp''']

 def __init__(    self :  Optional[int]						,							*A_ :  Any						,							**A_ :  Dict  )       ->     Optional[int]:

       """simple docstring"""






       requires_backends(self						,							['keras_nlp']  )



