fffiloni commited on
Commit
19540cf
·
verified ·
1 Parent(s): d341c8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -21
app.py CHANGED
@@ -7,28 +7,14 @@ import gradio as gr
7
 
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
-
15
- def fixed_get_imports(filename: str | os.PathLike) -> list[str]:
16
- if not str(filename).endswith("modeling_sa2va_chat.py"):
17
- return get_imports(filename)
18
- imports = get_imports(filename)
19
- imports.remove("flash_attn")
20
- return imports
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,
 
7
 
8
  # Load the model and tokenizer
9
  model_path = "ByteDance/Sa2VA-4B"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ model = AutoModel.from_pretrained(
12
+ model_path,
13
+ torch_dtype = torch.bfloat16,
14
+ low_cpu_mem_usage = True,
15
+ use_flash_attn = True,
16
+ trust_remote_code = True
17
+ ).eval().cuda()
18
 
19
  tokenizer = AutoTokenizer.from_pretrained(
20
  model_path,