runninglsy commited on
Commit
406aa8d
·
1 Parent(s): 54299ef

update ovis

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +1 -20
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: Ovis2 16B
3
  emoji: 🦫
4
- colorFrom: blue
5
- colorTo: red
6
  sdk: gradio
7
  sdk_version: 5.1.0
8
  app_file: app.py
 
1
  ---
2
  title: Ovis2 16B
3
  emoji: 🦫
4
+ colorFrom: yellow
5
+ colorTo: purple
6
  sdk: gradio
7
  sdk_version: 5.1.0
8
  app_file: app.py
app.py CHANGED
@@ -26,25 +26,6 @@ streamer = TextIteratorStreamer(text_tokenizer, skip_prompt=True, skip_special_t
26
  image_placeholder = '<image>'
27
  cur_dir = os.path.dirname(os.path.abspath(__file__))
28
 
29
- def submit_chat(chatbot, text_input):
30
- response = ''
31
- chatbot.append((text_input, response))
32
- return chatbot ,''
33
-
34
- # @spaces.GPU
35
- use_thread = False
36
-
37
- # load model
38
- model = AutoModelForCausalLM.from_pretrained(model_name,
39
- torch_dtype=torch.bfloat16,
40
- multimodal_max_length=8192,
41
- trust_remote_code=True).to(device='cuda')
42
- text_tokenizer = model.get_text_tokenizer()
43
- visual_tokenizer = model.get_visual_tokenizer()
44
- streamer = TextIteratorStreamer(text_tokenizer, skip_prompt=True, skip_special_tokens=True)
45
- image_placeholder = '<image>'
46
- cur_dir = os.path.dirname(os.path.abspath(__file__))
47
-
48
  logging.basicConfig(level=logging.INFO)
49
  logger = logging.getLogger(__name__)
50
 
@@ -66,7 +47,7 @@ def submit_chat(chatbot, text_input):
66
  chatbot.append((text_input, response))
67
  return chatbot ,''
68
 
69
- # @spaces.GPU
70
  def ovis_chat(chatbot: List[List[str]], image_input: Any):
71
  conversations, model_inputs = prepare_inputs(chatbot, image_input)
72
  gen_kwargs = initialize_gen_kwargs()
 
26
  image_placeholder = '<image>'
27
  cur_dir = os.path.dirname(os.path.abspath(__file__))
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  logging.basicConfig(level=logging.INFO)
30
  logger = logging.getLogger(__name__)
31
 
 
47
  chatbot.append((text_input, response))
48
  return chatbot ,''
49
 
50
+ @spaces.GPU
51
  def ovis_chat(chatbot: List[List[str]], image_input: Any):
52
  conversations, model_inputs = prepare_inputs(chatbot, image_input)
53
  gen_kwargs = initialize_gen_kwargs()