Update app.py
Browse files
app.py
CHANGED
|
@@ -27,8 +27,9 @@ import numpy as np
|
|
| 27 |
from huggingface_hub import hf_hub_download, list_repo_files
|
| 28 |
|
| 29 |
# flash attention
|
| 30 |
-
|
| 31 |
# subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
|
|
|
| 32 |
|
| 33 |
# Define constants
|
| 34 |
DESCRIPTION = "[ShowUI Demo](https://huggingface.co/showlab/ShowUI-2B)"
|
|
@@ -54,8 +55,8 @@ for file in files:
|
|
| 54 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 55 |
destination_folder,
|
| 56 |
torch_dtype=torch.bfloat16,
|
| 57 |
-
device_map="cpu",
|
| 58 |
-
|
| 59 |
)
|
| 60 |
|
| 61 |
# Load the processor
|
|
|
|
| 27 |
from huggingface_hub import hf_hub_download, list_repo_files
|
| 28 |
|
| 29 |
# flash attention
|
| 30 |
+
import subprocess
|
| 31 |
# subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 32 |
+
subprocess.run('pip install flash-attn --no-build-isolation', shell=True)
|
| 33 |
|
| 34 |
# Define constants
|
| 35 |
DESCRIPTION = "[ShowUI Demo](https://huggingface.co/showlab/ShowUI-2B)"
|
|
|
|
| 55 |
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
| 56 |
destination_folder,
|
| 57 |
torch_dtype=torch.bfloat16,
|
| 58 |
+
# device_map="cpu",
|
| 59 |
+
attn_implementation = "flash_attention_2",
|
| 60 |
)
|
| 61 |
|
| 62 |
# Load the processor
|