AdrienB134 commited on
Commit
b041f93
1 Parent(s): 6c26916
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -20,7 +20,7 @@ import time
20
  from PIL import Image
21
  import torch
22
  import subprocess
23
- # subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
24
 
25
 
26
 
@@ -45,7 +45,7 @@ def model_inference(
45
  # )
46
 
47
  #We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
48
- model = Qwen2VLForConditionalGeneration.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", trust_remote_code=True, torch_dtype="auto").cuda().eval()
49
 
50
  # default processer
51
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
 
20
  from PIL import Image
21
  import torch
22
  import subprocess
23
+ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
24
 
25
 
26
 
 
45
  # )
46
 
47
  #We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
48
+ model = Qwen2VLForConditionalGeneration.from_pretrained("Qwen/Qwen2-VL-2B-Instruct",attn_implementation="flash_attention_2", trust_remote_code=True, torch_dtype="auto").cuda().eval()
49
 
50
  # default processer
51
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")