-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
model.generate with prefix_allowed_tokens_fn throws RuntimeError: probability tensor contains either inf
, nan
or element < 0
#15169
Comments
@patrickvonplaten Pinging you to get your input on this. It seems However the script does seems to fail currently. I added a PR containing the "fix" to accelerate things along, but given everything is ingrained in tests and other logits processors actively use Other options I consider viable:
|
I don't think that this is related in any way to the A tip from my side @iamjanvijay would be to do the following. Create the |
@patrickvonplaten @Narsil Thanks for your response. I was trying to check why this is happening. I found that if the restricted_vocab at any generation step only includes "</s>" (end-of-sentence token) this error occurs. In other cases, the script doesn't encounter such an error. I'll try to look if all the elements at that generation step are set to -inf. |
I'll close my PR in the meantime. We can reopen it if needed, but I tend to agree with @patrickvonplaten that having everything |
Have you found what was causing the issue by any chance @iamjanvijay? I'm encountering the same issue while I'm using the generate function with BART, but I'm not using any prefix_allowed_tokens, and this error usually happens when I've been training the model for a while. Like @iamjanvijay said, I suspect something to do with cases where some tokens are masked or filtered, but I haven't really figured out where/why it's happening. I'd appreciate any pointers. |
@mindojune - could you maybe open a new issue as it's not related to |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
@mindojune |
Hey @hongyuntw, the reason is that BART forces the second token to be this id https://huggingface.co/facebook/bart-large/blob/main/config.json#L27 . However if you use additionally something like |
Was running into similar issues when using Consider removing |
i also have this problem,but i dont know how to fix |
Same I am also running into this issue, has there been any resolution for this ? |
i try another way to avoid this problem,i was apply minigpt-4 in 3090,when i use v0 version weight,the problem happen,for result it ,i try many pytorch version ,but it dosent work.finally,i use a new model version v1.1,this problem also away.so,i think the problem is relative with model.for minigpt4,model decoding is relateted with fschat here |
Did somebody solved this problem? |
cc @gante for reference |
@Chanwhistle have a look at this comment If you believe this comment does not apply to you, then a reproducer of the issue will be needed 🤗 |
Environment info
transformers
version: 4.15.0Who can help
@patrickvonplaten @Narsil
Information
Model I am using T5ForConditionalGeneration:
The problem arises when using my own modified scripts:
Script to reproduce error is mentioned below.
The tasks I am working on is my own task or dataset:
The task requires conditional generation from T5, in such a way, that the output vocabulary is restricted to a small set.
To reproduce
Expected behavior
No error.
Possible solution
The call function for class "InfNanRemoveLogitsProcessor" should include the following statement before returning "scores".
The text was updated successfully, but these errors were encountered: