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

Set output_attentions=True for model.geneate #35393

Open
2 of 4 tasks
yiyexy opened this issue Dec 23, 2024 · 2 comments
Open
2 of 4 tasks

Set output_attentions=True for model.geneate #35393

yiyexy opened this issue Dec 23, 2024 · 2 comments
Labels

Comments

@yiyexy
Copy link

yiyexy commented Dec 23, 2024

System Info

transformers==4.44.0
Ubuntu 22.04.2 LTS
python==3.10.13

Who can help?

@ArthurZucker

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. I used the LLaVA arch with LlavaQwen2ForCausalLM.
  2. I will get right response with output_attentions=False in model.generate()
  3. The response are not expected and some nan in scores with output_attentions=True.

Expected behavior

I expected get normal response with attention score.

@yiyexy yiyexy added the bug label Dec 23, 2024
@yiyexy
Copy link
Author

yiyexy commented Dec 23, 2024

output_ids = model.generate(
                input_ids,
                images=images,
                attention_mask=None,
                do_sample=False,
                max_new_tokens=1024,
                use_cache=True,
                stopping_criteria=[stopping_criteria],
                output_attentions=True,
                output_scores=True,
                return_dict_in_generate=True,
                )

image

@Kamichanw
Copy link

Could you provide a minimal reproducible code?

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

No branches or pull requests

2 participants