UnboundLocalError: cannot access local variable 'attn_weights' where it is not associated with a value

#17
by yyuxuan - opened

When using model.generate(), met this error. Transformers == 4.40.0

I believe this issue is related to flash_attention. In the Qwen2FlashAttention2 class (which inherits from Qwen2Attention) in modeling_qwen2.py, the attn_weights variable is not initialized beforehand.

yyuxuan changed discussion status to closed
yyuxuan changed discussion status to open

Sign up or log in to comment