Spaces:
Runtime error
Runtime error
Commit
Β·
7ea3311
1
Parent(s):
ba3540b
flash attn
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import imagehash
|
|
| 7 |
import cv2
|
| 8 |
import os
|
| 9 |
import spaces
|
|
|
|
| 10 |
|
| 11 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 12 |
from transformers.image_utils import to_numpy_array, PILImageResampling, ChannelDimension
|
|
@@ -19,6 +20,9 @@ from collections import Counter
|
|
| 19 |
from datasets import load_dataset, concatenate_datasets
|
| 20 |
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
DEVICE = torch.device("cuda")
|
| 23 |
PROCESSOR = AutoProcessor.from_pretrained(
|
| 24 |
"HuggingFaceM4/idefics2_raven_finetuned",
|
|
|
|
| 7 |
import cv2
|
| 8 |
import os
|
| 9 |
import spaces
|
| 10 |
+
import subprocess
|
| 11 |
|
| 12 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 13 |
from transformers.image_utils import to_numpy_array, PILImageResampling, ChannelDimension
|
|
|
|
| 20 |
from datasets import load_dataset, concatenate_datasets
|
| 21 |
|
| 22 |
|
| 23 |
+
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
DEVICE = torch.device("cuda")
|
| 27 |
PROCESSOR = AutoProcessor.from_pretrained(
|
| 28 |
"HuggingFaceM4/idefics2_raven_finetuned",
|