




import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel




class     snake_case__							(_UpperCamelCase   ):
				"""simple docstring"""



				SCREAMING_SNAKE_CASE_       :							Optional[Any]							 =					"""M-CLIP"""





				def __init__(      self				:     List[str]					,      __lowerCamelCase				:     Optional[Any]=10_24					,      __lowerCamelCase				:     Union[str, Any]=7_68					,      **__lowerCamelCase				:     int							)					->     Optional[Any]:
							a    =			transformerDimSize
							a    =			imageDimSize
							super().__init__(**__lowerCamelCase							)




class     snake_case__							(_UpperCamelCase   ):
				"""simple docstring"""



				SCREAMING_SNAKE_CASE_       :							List[Any]							 =					MCLIPConfig





				def __init__(      self				:     Tuple					,      __lowerCamelCase				:     Optional[Any]					,      *__lowerCamelCase				:     Any					,      **__lowerCamelCase				:     Tuple							)					->     Union[str, Any]:
							super().__init__(__lowerCamelCase					,      *__lowerCamelCase					,      **__lowerCamelCase							)
							a    =			XLMRobertaModel(__lowerCamelCase							)
							a    =			torch.nn.Linear(
							    in_features=config.transformerDimensions					,      out_features=config.numDims							)





				def 							__UpperCAmelCase							(      self				:     Tuple					,      __lowerCamelCase				:     str					,      __lowerCamelCase				:     Any							)					->     Tuple:
							a    =			self.transformer(input_ids=__lowerCamelCase					,      attention_mask=__lowerCamelCase							)[0]
							a    =			(embs * attention_mask.unsqueeze(2							)).sum(dim=1							) / attention_mask.sum(dim=1							)[:, None]
							return self.LinearTransformation(__lowerCamelCase							), embs












import warnings

from ...utils import logging
from .image_processing_donut import DonutImageProcessor


__lowerCAmelCase		:				List[Any]       			=		logging.get_logger(__name__)




class     snake_case__							(_UpperCamelCase   ):
				"""simple docstring"""



				def __init__(      self				:     Union[str, Any]					,      *__lowerCamelCase				:     Optional[Any]					,      **__lowerCamelCase				:     Dict							)					->     None:
							warnings.warn(
							    "The class DonutFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
							    " use DonutImageProcessor instead."					,      __lowerCamelCase					,      )
							super().__init__(*__lowerCamelCase					,      **__lowerCamelCase							)






