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

Missing _use_flash_attention_2 in Llama Model with ContrastVecLlamaForCausalLM #56

Open
slfg opened this issue Oct 22, 2024 · 1 comment

Comments

@slfg
Copy link

slfg commented Oct 22, 2024

Hello, I encountered an error while following the honesty_contrast_vec_TQA_mc example. When using the ContrastVecLlamaForCausalLM class with the Llama-2-7b-hf model (I also tested with Llama-2-7b-chat-hf), I received the following error:

   1727             if name in modules:
   1728                 return modules[name]
-> 1729         raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
   1730 
   1731     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'LlamaModel' object has no attribute '_use_flash_attention_2'

This error occurred at the following line:

model_baseline_acc = get_tqa_accuracy(model, questions, answers, labels, tokenizer, batch_size=batch_size)

I tried downgrading and upgrading the relevant packages (transformers, torch and accelerate) without success.

Environment Details

  • Transformers version: Between 4.45.2 and 4.42.3
  • Torch version: Between 2.5.0+cu124 and 2.4.0
  • Accelerate version: Between 1.0.1 and 0.31.0
  • torch_dtype: bfloat16 and float16
@NaOH678
Copy link

NaOH678 commented Dec 4, 2024

I encountered the same error, but I don't have any idea (

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

2 participants