Given a sequence: a b c [SEP] d e f
,
the corresponding labels is : -1 -1 -1 0 1 0 0
.
I want to compute the loss loss_func(logits,labels,ignore_index=-1)
to ignore the tokens before [SEP]
.
And I got a RuntimeError: multi-target not supported at /opt/conda/conda-bld/pytorch_1603729096996
.
So I have to change labels to “class indice mode” like 4
, but how to ignore the previous tokens when calculating loss.