Skip to content
Snippets Groups Projects
Unverified Commit d641f769 authored by JulianFP's avatar JulianFP
Browse files

T5 MLM: Add next extra_id to end of label ids like it was done in training of T5 (see paper)

parent 61c49c3e
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ def classify_entity(sentence, entity, labels):
results = {}
for label in labels:
label_ids = tokenizer(f"<extra_id_0> {label}", return_tensors="pt").input_ids
label_ids = tokenizer(f"<extra_id_0> {label} <extra_id_1>", return_tensors="pt").input_ids
loss = model(input_ids=input_ids, labels=label_ids).loss.item()
results[loss] = label
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment