fffiloni commited on
Commit
bdee200
·
verified ·
1 Parent(s): fedbb19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from transformers import AutoTokenizer, AutoModel
3
  from PIL import Image
4
  import numpy as np
5
  import os
@@ -8,18 +8,16 @@ import gradio as gr
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,
21
  trust_remote_code = True,
22
- use_fast = False
23
  )
24
 
25
  def image_vision(image_input_path, prompt):
 
1
  import torch
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
3
  from PIL import Image
4
  import numpy as np
5
  import os
 
8
  # Load the model and tokenizer
9
  model_path = "ByteDance/Sa2VA-4B"
10
 
11
+ model = AutoModelForCausalLM.from_pretrained(
12
  model_path,
13
+ torch_dtype="auto",
14
+ device_map="auto",
15
+ trust_remote_code=True,
 
16
  ).eval().cuda()
17
 
18
  tokenizer = AutoTokenizer.from_pretrained(
19
  model_path,
20
  trust_remote_code = True,
 
21
  )
22
 
23
  def image_vision(image_input_path, prompt):