-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SEP] Token in the QA model response #2607
Comments
I would like to recommend you to use HuggingFace model, it uses Huggingface tokenizer and a more consistent post processing translator
|
Thanks @frankfliu |
Another question.. I see that the implementation of I've this custom translator implemented in order to use this HuggingFace model:
}` This is having the same problem (the one reported in this issue) in returning separator tokens in the response. From what I could see, the problem of the tokens seems to be related more to the model than the translator, because the problem are the returned indexes. I do not know if changing this helps. |
It's seems your model didn't return correct result. Did you try run inference with python? |
Yes, in python it returns the first part of the context as the answer. Therefore: "BBC Japan". |
A few thing to check:
|
Hi @frankfliu sorry for the delay
The points you mentioned, in this case, are managed internally, I have no power over them.. |
@aruggero We have unit-test test against this model nightly and didn't see the issue you mentioned. |
Hi @frankfliu I see that your example is a bit different. |
will take a look. |
You can use
|
Hi @frankfliu |
You can use the Encoding::getSpecialTokenMask() from ai.djl.huggingface.tokenizers to limit the prediction to be only in the original "context" and exclude the special tokens in your custom translator's processOutput(). In general, I would recommend following the suggestion by @frankfliu to run all the inference steps in Python with a traced model of interest on a simple input and compare the raw outputs/logits to those you get in djl. Then you would know if it is an issue with the model itself behaving differently with djl (highly unlikely) or the pre/post processing steps are different (and you can look up HF source code for the details). As to why the model predicts the special tokens to be a part of the answer, I don't think there are any strict masks applied to the output to prevent it, and the fine-tuning objective might not be penalizing it (enough). |
Description
The [SEP] token used in input for the Question Answering model "distilbert" of the DJL is returned as part of the extracted answer to the question.
Shouldn't be the answer extracted from the context only? And not from the concatenation of query + context?
Expected Behavior
I would expect to see the answer belonging only to the context, without any delimitation token.
Error Message
With an input like:
var question = "BBC Japan broadcasting";
var resourceDocument = "BBC Japan was a general entertainment Channel.\nWhich operated between December 2004 and April 2006.\nIt ceased operations after its Japanese distributor folded.";
The following answer is returned: "bbc japan broadcasting [SEP] bbc japan"
How to Reproduce?
Answer: "bbc japan broadcasting [SEP] bbc japan"
What have you tried to solve it?
Environment Info
The text was updated successfully, but these errors were encountered: