




'''simple docstring'''







import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel

class 	_snake_case(			UpperCAmelCase      ):
 __snake_case:							Optional[Any]						=					'''M-CLIP'''






 def __init__(self       :  Any    ,		a       :  Any=10_24    ,		a       :  Optional[Any]=7_68    ,		**a       :  int    )       ->   Optional[Any]:






    """simple docstring"""


    A__       =     transformerDimSize
    A__       =     imageDimSize
    super().__init__(**a    )




class 	_snake_case(			UpperCAmelCase      ):
 __snake_case:							Union[str, Any]						=					MCLIPConfig






 def __init__(self       :  Optional[int]    ,		a       :  Dict    ,		*a       :  Any    ,		**a       :  Any    )       ->   str:






    """simple docstring"""


    super().__init__(a    ,		*a    ,		**a    )
    A__       =     XLMRobertaModel(a    )
    A__       =     torch.nn.Linear(
        in_features=config.transformerDimensions    ,		out_features=config.numDims    )






 def 						_UpperCamelCase (self       :  Optional[Any]    ,		a       :  Optional[int]    ,		a       :  Any    )       ->   Union[str, Any]:






    """simple docstring"""


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








'''simple docstring'''







def 						_A      ( UpperCAmelCase = 1      ,UpperCAmelCase = 1000						):






   '''simple docstring'''







   A__       =     1
   A__       =     0

   for divide_by_number in range(UpperCAmelCase      ,digit + 1						):
      A__       =     []
      A__       =     numerator
      for _ in range(1      ,digit + 1						):
         if now_divide in has_been_divided:
            if longest_list_length < len(UpperCAmelCase						):
               A__       =     len(UpperCAmelCase						)
               A__       =     divide_by_number
         else:
            has_been_divided.append(UpperCAmelCase						)
            A__       =     now_divide * 10 % divide_by_number

   return the_digit


# Tests
if __name__ == "__main__":
    import doctest

    doctest.testmod()


