Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import gradio as gr
|
|
8 |
# Load the model and tokenizer
|
9 |
model_path = "ByteDance/Sa2VA-4B"
|
10 |
|
|
|
11 |
from unittest.mock import patch
|
12 |
from transformers.dynamic_module_utils import get_imports
|
13 |
|
@@ -20,14 +21,14 @@ def fixed_get_imports(filename: str | os.PathLike) -> list[str]:
|
|
20 |
|
21 |
|
22 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
tokenizer = AutoTokenizer.from_pretrained(
|
33 |
model_path,
|
|
|
8 |
# Load the model and tokenizer
|
9 |
model_path = "ByteDance/Sa2VA-4B"
|
10 |
|
11 |
+
"""
|
12 |
from unittest.mock import patch
|
13 |
from transformers.dynamic_module_utils import get_imports
|
14 |
|
|
|
21 |
|
22 |
|
23 |
with patch("transformers.dynamic_module_utils.get_imports", fixed_get_imports):
|
24 |
+
"""
|
25 |
+
model = AutoModel.from_pretrained(
|
26 |
+
model_path,
|
27 |
+
torch_dtype = torch.bfloat16,
|
28 |
+
low_cpu_mem_usage = False,
|
29 |
+
use_flash_attn = False,
|
30 |
+
trust_remote_code = True
|
31 |
+
).eval().cuda()
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(
|
34 |
model_path,
|