KoonJamesZ commited on
Commit
d96324e
·
verified ·
1 Parent(s): 28f7346

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -16,18 +16,18 @@ from ultralytics import YOLO
16
  import gradio as gr
17
 
18
  # # default: Load the model on the available device(s)
19
- # model = Qwen2VLForConditionalGeneration.from_pretrained(
20
- # "Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
21
- # )
22
-
23
- # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
24
  model = Qwen2VLForConditionalGeneration.from_pretrained(
25
- "Qwen/Qwen2-VL-7B-Instruct",
26
- torch_dtype=torch.bfloat16,
27
- attn_implementation="flash_attention_2",
28
- device_map="auto",
29
  )
30
 
 
 
 
 
 
 
 
 
31
  # default processer
32
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
33
 
 
16
  import gradio as gr
17
 
18
  # # default: Load the model on the available device(s)
 
 
 
 
 
19
  model = Qwen2VLForConditionalGeneration.from_pretrained(
20
+ "Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
 
 
 
21
  )
22
 
23
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
24
+ # model = Qwen2VLForConditionalGeneration.from_pretrained(
25
+ # "Qwen/Qwen2-VL-7B-Instruct",
26
+ # torch_dtype=torch.bfloat16,
27
+ # attn_implementation="flash_attention_2",
28
+ # device_map="auto",
29
+ # )
30
+
31
  # default processer
32
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
33