Skip to content
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

I think this a bug. caption.py 140 #196

Open
tigerbrother222 opened this issue Aug 3, 2023 · 5 comments
Open

I think this a bug. caption.py 140 #196

tigerbrother222 opened this issue Aug 3, 2023 · 5 comments

Comments

@tigerbrother222
Copy link

incomplete_inds = [ind for ind, next_word in enumerate(next_word_inds) if next_word != word_map['']]
incomplete_inds always is [0,1,2,3,4] .
and then
complete_inds = list(set(range(len(next_word_inds))) - set(incomplete_inds))
complete_inds is empty
so complete_seqs is null.

my Model out is error

@ArborealSky
Copy link

I have the same bug in caption.py . Did you fix it ?

@ArborealSky
Copy link

ArborealSky commented Dec 26, 2023

i fix it , you should consider the situation that your model is too weak to generate the <end> symbol for ending your sentences.

@ArborealSky
Copy link

ArborealSky commented Dec 26, 2023

please add code

if len(complete_seqs_scores) == 0:
        return seqs[0], 0

before

i = complete_seqs_scores.index(max(complete_seqs_scores))

in fuction caption_image_beam_search

@gsoykan
Copy link

gsoykan commented Jan 3, 2024

why don't you use it like the following ? Is there any specific reason why you are returning 0 instead of matching attention map?

if len(complete_seqs_scores) == 0:
    return seqs[0], seqs_alpha[0]

@ArborealSky
Copy link

why don't you use it like the following ? Is there any specific reason why you are returning 0 instead of matching attention map?

if len(complete_seqs_scores) == 0:
    return seqs[0], seqs_alpha[0]

You are right. Actually, the code in my project doesn't need to care about seqs_alpha. So I just used '0' to replace its return. Your code are more complete and better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants