# Load Phi 3 small on Nvidia Tesla V100 - Flash Attention

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 25, 2024, 10:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360 "2024-07-25T10:52:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman174](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@roman174](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Froman174)%5C
**Post date:** [July 25, 2024, 10:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360%2F1 "2024-07-25T10:52:47Z")

</div>

Hi,  
I would like to inquire about the possibility of uploading and fine tuning a Phi 3 8k small. When I load the model, I get an error about missing Flash attention. If I want to install the given package, I get this error :

```auto
RuntimeError: FlashAttention is only supported on CUDA 11.6 and above. Note: make sure nvcc has a supported version by running nvcc -V.

      torch. __version__ = 2.3.1+cu121

```

But I have the required version of pytorch and CUDA (torch 2.3.1 and cuda 12.1)  
Is it because I am using a Tesla V100 graphics card? Is there any way to load the model also with this graphics card?  
I found this in the documentation for the Phi 3 mini on Huggingface:

```auto
If you want to run the model on:
NVIDIA V100 or earlier generation GPUs: call AutoModelForCausalLM.from_pretrained() with attn_implementation="eager"

```

Does this also apply to the Phi3 Small 8k?? Beacause when I try to load it, the error occurs

```auto
model = AutoModelForSequenceClassification.from_pretrained("path", num_labels=num_labels ,attn_implementation="eager" )

AssertionError: Flash Attention is not available, but is needed for dense attention

```

Or should I try the ONNX version or it is just for inference?  
Thank you.

---

<div class="post-metadata">

**Author:** ![antonpolishko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/antonpolishko/32/29772_2.png) [@antonpolishko](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fantonpolishko)%5C
**Post date:** [July 31, 2024, 9:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360%2F2 "2024-07-31T09:16:08Z")

</div>

v100 is Volta generation GPU and has Compute Compatibility 7.0, which is not supported by flash-attention. You need to have Ampere or later GPUs.

Based on [transformers/src/transformers/models/phi3/modeling\_phi3.py at 47c29ccfaf56947d845971a439cbe75a764b63d7 · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/blob/47c29ccfaf56947d845971a439cbe75a764b63d7/src/transformers/models/phi3/modeling_phi3.py#L676) you should be able to run it in “eager” mode. Make sure you have the latest transformers library

---

<div class="post-metadata">

**Author:** ![roman174](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@roman174](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Froman174)%5C
**Post date:** [July 31, 2024, 12:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360%2F3 "2024-07-31T12:30:00Z")

</div>

@antonpolishko  
Thank you for response.  
Yes, I have the latest transformers library and I tried this:  
`model = AutoModelForSequenceClassification.from_pretrained("path", num_labels=num_labels ,attn_implementation="eager" )`  
But still I have the error:  
`AssertionError: Flash Attention is not available, but is needed for dense attention`  
Do you have some idea what to do?

---

<div class="post-metadata">

**Author:** ![roman174](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@roman174](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Froman174)%5C
**Post date:** [August 6, 2024, 7:36am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fload-phi-3-small-on-nvidia-tesla-v100-flash-attention%2F99360%2F4 "2024-08-06T07:36:04Z")

</div>

I opened an issue on github at trnasformers. Unable to load model in eager mode.
