'''simple docstring'''

import torch

from transformers import CamembertForMaskedLM, CamembertTokenizer
def       __UpperCamelCase	(       UpperCAmelCase		,					UpperCAmelCase		,					UpperCAmelCase		,					UpperCAmelCase=5					):
 # Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/roberta/hub_interface.py
 assert masked_input.count('''<mask>'''					) == 1
 lowercase__    :   Union[str, Any]						= torch.tensor(tokenizer.encode(UpperCAmelCase		,					add_special_tokens=UpperCAmelCase					)					).unsqueeze(0					)  # Batch size 1
 lowercase__    :   Tuple						= model(UpperCAmelCase					)[0]  # The last hidden-state is the first element of the output tuple
 lowercase__    :   Optional[Any]						= (input_ids.squeeze() == tokenizer.mask_token_id).nonzero().item()
 lowercase__    :   int						= logits[0, masked_index, :]
 lowercase__    :   Union[str, Any]						= logits.softmax(dim=0					)
 lowercase__			,							lowercase__    :   Any						= prob.topk(k=UpperCAmelCase		,					dim=0					)
 lowercase__    :   Tuple						= ''' '''.join(
     [tokenizer.convert_ids_to_tokens(indices[i].item()					) for i in range(len(UpperCAmelCase					)					)]					)
 lowercase__    :   Union[str, Any]						= tokenizer.mask_token
 lowercase__    :   Union[str, Any]						= []
 for index, predicted_token_bpe in enumerate(topk_predicted_token_bpe.split(''' '''					)					):
  lowercase__    :   Any						= predicted_token_bpe.replace('''\u2581'''		,					''' '''					)
  if " {0}".format(UpperCAmelCase					) in masked_input:
   topk_filled_outputs.append(
       (
           masked_input.replace(''' {0}'''.format(UpperCAmelCase					)		,					UpperCAmelCase					),
           values[index].item(),
           predicted_token,
       )					)
  else:
   topk_filled_outputs.append(
       (
           masked_input.replace(UpperCAmelCase		,					UpperCAmelCase					),
           values[index].item(),
           predicted_token,
       )					)
 return topk_filled_outputs


__a:			Any	       =       CamembertTokenizer.from_pretrained("""camembert-base""")
__a:			Any	       =       CamembertForMaskedLM.from_pretrained("""camembert-base""")
model.eval()

__a:			List[str]	       =       """Le camembert est <mask> :)"""





print(fill_mask(masked_input, model, tokenizer, topk=3))


'''simple docstring'''

def       __UpperCamelCase	(       ):
 lowercase__    :   Any						= [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

 lowercase__    :   Any						= 6
 lowercase__    :   Optional[Any]						= 1
 lowercase__    :   int						= 1901

 lowercase__    :   List[str]						= 0

 while year < 2001:
  day += 7

  if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
   if day > days_per_month[month - 1] and month != 2:
    month += 1
    lowercase__    :   List[Any]						= day - days_per_month[month - 2]
   elif day > 29 and month == 2:
    month += 1
    lowercase__    :   Any						= day - 29
  else:
   if day > days_per_month[month - 1]:
    month += 1
    lowercase__    :   List[Any]						= day - days_per_month[month - 2]

  if month > 12:
   year += 1
   lowercase__    :   Dict						= 1

  if year < 2001 and day == 1:
   sundays += 1
 return sundays


if __name__ == "__main__":
  print(solution())

