Unify label args (#4722)

* Deprecate masked_lm_labels argument

* Apply to all models

* Better error message
This commit is contained in:
Sylvain Gugger
2020-06-03 09:36:26 -04:00
committed by GitHub
parent 3e5928c57d
commit 1b5820a565
14 changed files with 223 additions and 93 deletions

View File

@@ -489,7 +489,7 @@ class CTRLLMHeadModel(CTRLPreTrainedModel):
r"""
labels (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`, defaults to :obj:`None`):
Labels for language modeling.
Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids``
Note that the labels **are shifted** inside the model, i.e. you can set ``labels = input_ids``
Indices are selected in ``[-100, 0, ..., config.vocab_size]``
All labels set to ``-100`` are ignored (masked), the loss is only
computed for labels in ``[0, ..., config.vocab_size]``