text: 
  
  TITLE
  I'm getting "nan" value for loss, while following a tutorial from the documentation
  
  COMMENTS
  2
  
  REACTIONS
  +1: 0
  -1: 0
  laugh: 0
  hooray: 0
  heart: 0
  rocket: 0
  eyes: 0
  
  BODY
  # ❓ Questions & Help
  
  
  ## Details
  Hi,
  
  I’m following the “Fine-tuning with Custom Dataset” tutorial for Question Answering on the SQuaD dataset tutorial: [available here](https://huggingface.co/transformers/custom_datasets.html#question-answering-with-squad-2-0). I’ve copy-pasted all the code shown in the tutorial step by step. However, when my model starts training, I don’t get the expected metric values for loss as I normally would, instead I get “nan”. Here is the code for training
  `model.fit(train_dataset.shuffle(1000).batch(16), epochs=3, batch_size=16)`
  
  Here is the output with the "nan" values for the losses.
  ```
  Epoch 1/3
  5427/5427 [==============================] - 4604s 848ms/step - loss: nan - output_1_loss: nan - output_2_loss: nan
  Epoch 2/3
  365/5427 [=>…] - ETA: 1:11:28 - loss: nan - output_1_loss: nan - output_2_loss: nan
  
  ```
  I don’t know what is wrong, and I don’t think this output is what is supposed to be.
  
  Would appreciate any help with this regard.
  Thank you.
  
  
  **A link to original question on the forum/Stack Overflow**:
  https://discuss.huggingface.co/t/im-getting-nan-value-for-loss-while-following-a-tutorial-from-the-documentatin/1530