"""simple docstring"""






import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel
class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					snake_case__       					=				"M-CLIP"







					def __init__(       self     :			str					,lowerCamelCase__     :			Optional[Any]=1_024					,lowerCamelCase__     :			Union[str, Any]=768					,**lowerCamelCase__     :			Any    ):
									UpperCAmelCase__    =							transformerDimSize
									UpperCAmelCase__    =							imageDimSize
									super().__init__(**lowerCamelCase__    )






class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					snake_case__       					=				MCLIPConfig







					def __init__(       self     :			List[Any]					,lowerCamelCase__     :			Tuple					,*lowerCamelCase__     :			str					,**lowerCamelCase__     :			Tuple    ):
									super().__init__(lowerCamelCase__					,*lowerCamelCase__					,**lowerCamelCase__    )
									UpperCAmelCase__    =							XLMRobertaModel(lowerCamelCase__    )
									UpperCAmelCase__    =							torch.nn.Linear(
									    in_features=config.transformerDimensions					,out_features=config.numDims    )







					def 	__lowerCAmelCase		(       self     :			List[Any]					,lowerCamelCase__     :			Union[str, Any]					,lowerCamelCase__     :			str    ):
									UpperCAmelCase__    =							self.transformer(input_ids=lowerCamelCase__					,attention_mask=lowerCamelCase__    )[0]
									UpperCAmelCase__    =							(embs * attention_mask.unsqueeze(2    )).sum(dim=1    ) / attention_mask.sum(dim=1    )[:, None]
									return self.LinearTransformation(lowerCamelCase__    ), embs



"""simple docstring"""






import warnings
from functools import wraps
from typing import Callable



def 						a_		(      lowerCamelCase ):

				@wraps(lowerCamelCase )
				def _inner_fn(*lowerCamelCase      ,    **lowerCamelCase ):
								warnings.warn(
								    (f'''\'{fn.__name__}\' is experimental and might be subject to breaking changes in the future.''')      ,    lowerCamelCase      ,    )
								return fn(*lowerCamelCase      ,    **lowerCamelCase )

				return _inner_fn



