text: 
  
  TITLE
  quick question about `BertForMaskedLM`
  
  COMMENTS
  2
  
  REACTIONS
  +1: 0
  -1: 0
  laugh: 0
  hooray: 0
  heart: 0
  rocket: 0
  eyes: 0
  
  BODY
  Hello,
  I have a question about the example code that can be found in the documentation for `BertForMaskedLM` model. The example from the documentation is shown below:
  ```python
  from transformers import BertTokenizer, BertForMaskedLM
  import torch
  tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
  model = BertForMaskedLM.from_pretrained('bert-base-uncased', return_dict=True)
  input_ids = tokenizer("Hello, my dog is cute", return_tensors="pt")["input_ids"]
  outputs = model(input_ids, labels=input_ids)
  loss = outputs.loss
  prediction_logits = outputs.logits
  ```
  In this example, from the input string "Hello, my dog is cute", I don't see any `mask_token` in it. Also, the example code simply passes the label as `label=input_ids`. 
  
  So in this particular example, how exactly does the `BertForMaskedLM` model calculate the masked-LM loss (since the `mask_token` is not specified in the input string)? when I simply pass `labels = input_ids`, does `BertForMaskedLM` model automatically place the `mask_token` over the the first token of the input string (or something similar to this)?
  
  I don't think that the code provided in the documentation is wrong, because when I run the code on my machine, it runs smoothly without generating any error.
  
  Thank you,