





"""simple docstring"""




import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel




class 			_a						(				a__    ):
				UpperCamelCase								=   "M-CLIP"






				def __init__(			self		:   str,			lowerCAmelCase__		:   int=1_0_2_4,			lowerCAmelCase__		:   Optional[Any]=7_6_8,			**lowerCAmelCase__		:   Optional[int]							)     ->				Dict:




										'''simple docstring'''



										_UpperCamelCase      : List[Any]         =   transformerDimSize
										_UpperCamelCase      : Tuple         =   imageDimSize
										super().__init__(**SCREAMING_SNAKE_CASE_							)




class 			_a						(				a__    ):
				UpperCamelCase								=   MCLIPConfig






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




										'''simple docstring'''



										super().__init__(SCREAMING_SNAKE_CASE_,			*SCREAMING_SNAKE_CASE_,			**SCREAMING_SNAKE_CASE_							)
										_UpperCamelCase      : List[str]         =   XLMRobertaModel(SCREAMING_SNAKE_CASE_							)
										_UpperCamelCase      : Dict         =   torch.nn.Linear(
										    in_features=config.transformerDimensions,			out_features=config.numDims							)






				def     snake_case     (			self		:   str,			lowerCAmelCase__		:   List[Any],			lowerCAmelCase__		:   Optional[int]							)     ->				Tuple:




										'''simple docstring'''



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













"""simple docstring"""




UpperCamelCase_									=[
    """DownloadConfig""",
    """DownloadManager""",
    """DownloadMode""",
    """StreamingDownloadManager""",
]

from .download_config import DownloadConfig
from .download_manager import DownloadManager, DownloadMode
from .streaming_download_manager import StreamingDownloadManager



