"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "1ad1c4a864a385f6cebd5a450c95e50934a2c25c"
Unverified Commit 72c6e8b8 authored by Xing Han Lu's avatar Xing Han Lu Committed by GitHub
Browse files

Update t5.rst (#14776)

parent a94105f9
......@@ -191,10 +191,8 @@ language modeling head on top of the decoder.
labels = target_encoding.input_ids
# replace padding token id's of the labels by -100
labels = [
[(label if label != tokenizer.pad_token_id else -100) for label in labels_example] for labels_example in labels
]
labels = torch.tensor(labels)
labels[labels == tokenizer.pad_token_id] = -100
# forward pass
loss = model(input_ids=input_ids, attention_mask=attention_mask, labels=labels).loss
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment