Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig, TextStreamer
|
|
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
import re
|
@@ -27,13 +28,13 @@ import tempfile
|
|
27 |
from transformers import AutoTokenizer
|
28 |
from transformers.generation import GenerationConfig
|
29 |
|
30 |
-
DEFAULT_CKPT_PATH = 'Qwen/Qwen2-VL-
|
31 |
-
device_map = "
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(
|
34 |
DEFAULT_CKPT_PATH, trust_remote_code=True,
|
35 |
)
|
36 |
-
model =
|
37 |
DEFAULT_CKPT_PATH,
|
38 |
device_map=device_map,
|
39 |
trust_remote_code=True,
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig, TextStreamer
|
3 |
+
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
4 |
import torch
|
5 |
from PIL import Image
|
6 |
import re
|
|
|
28 |
from transformers import AutoTokenizer
|
29 |
from transformers.generation import GenerationConfig
|
30 |
|
31 |
+
DEFAULT_CKPT_PATH = 'Qwen/Qwen2-VL-2B-Instruct-GPTQ-Int4'
|
32 |
+
device_map = "auto"
|
33 |
|
34 |
tokenizer = AutoTokenizer.from_pretrained(
|
35 |
DEFAULT_CKPT_PATH, trust_remote_code=True,
|
36 |
)
|
37 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
38 |
DEFAULT_CKPT_PATH,
|
39 |
device_map=device_map,
|
40 |
trust_remote_code=True,
|