Custom loss: does this word exist
Hi,I am trying to have a custom loss, that checks whether certain words exist in the generated output.This is giving me multiple problems:I cannot be sure that each word I am looking for is represented as one tokenI cannot just decode the output and look for the words, since this breaks the gradient tapeWhat would be the best way to identify how many of a certain set of tokens is present in the model output while keeping the gradient intact?