



'''simple docstring'''





import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel







class        UpperCAmelCase_			(			_a      ):
    """simple docstring"""







    lowercase   =						"M-CLIP"




    def __init__(       self   :	Dict					,	snake_case_   :	Optional[Any]=1_024					,	snake_case_   :	Dict=768					,	**snake_case_   :	Dict		):
          snake_case__    :       List[str]       		= transformerDimSize
          snake_case__    :       int       		= imageDimSize
          super().__init__(**snake_case_		)







class        UpperCAmelCase_			(			_a      ):
    """simple docstring"""







    lowercase   =						MCLIPConfig




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




    def lowerCamelCase			(       self   :	Any					,	snake_case_   :	int					,	snake_case_   :	Optional[int]		):
          snake_case__    :       int       		= self.transformer(input_ids=snake_case_					,	attention_mask=snake_case_		)[0]
          snake_case__    :       List[Any]       		= (embs * attention_mask.unsqueeze(2		)).sum(dim=1		) / attention_mask.sum(dim=1		)[:, None]
          return self.LinearTransformation(snake_case_		), embs





'''simple docstring'''





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__a  			=						{
    "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __a  			=						[
           "GPT_BIGCODE_PRETRAINED_MODEL_ARCHIVE_LIST",
           "GPTBigCodeForSequenceClassification",
           "GPTBigCodeForTokenClassification",
           "GPTBigCodeForCausalLM",
           "GPTBigCodeModel",
           "GPTBigCodePreTrainedModel",
       ]

if TYPE_CHECKING:
       from .configuration_gpt_bigcode import GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTBigCodeConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_gpt_bigcode import (
                  GPT_BIGCODE_PRETRAINED_MODEL_ARCHIVE_LIST,
                  GPTBigCodeForCausalLM,
                  GPTBigCodeForSequenceClassification,
                  GPTBigCodeForTokenClassification,
                  GPTBigCodeModel,
                  GPTBigCodePreTrainedModel,
              )


else:
       import sys

       __a  			=						_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
