
import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel




class      __A(    __lowerCamelCase			):

		"""simple docstring"""
		SCREAMING_SNAKE_CASE__         =      """M-CLIP"""







		def __init__(self	,      SCREAMING_SNAKE_CASE_=10_24	,      SCREAMING_SNAKE_CASE_=7_68	,      **SCREAMING_SNAKE_CASE_						):
							UpperCamelCase__				=    transformerDimSize
							UpperCamelCase__				=    imageDimSize
							super().__init__(**SCREAMING_SNAKE_CASE_						)






class      __A(    __lowerCamelCase			):

		"""simple docstring"""
		SCREAMING_SNAKE_CASE__         =      MCLIPConfig







		def __init__(self	,      SCREAMING_SNAKE_CASE_	,      *SCREAMING_SNAKE_CASE_	,      **SCREAMING_SNAKE_CASE_						):
							super().__init__(SCREAMING_SNAKE_CASE_	,      *SCREAMING_SNAKE_CASE_	,      **SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    XLMRobertaModel(SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    torch.nn.Linear(
							    in_features=config.transformerDimensions	,      out_features=config.numDims						)







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







from typing import TYPE_CHECKING

from ...utils import _LazyModule


lowerCamelCase_						     =					{'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']}


if TYPE_CHECKING:
    from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
    import sys

    lowerCamelCase_						     =					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





