qnguyen3 commited on
Commit
a2b8740
·
verified ·
1 Parent(s): 1266db9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -23,8 +23,6 @@ model = LlavaQwen2ForCausalLM.from_pretrained(
23
  attn_implementation="flash_attention_2",
24
  trust_remote_code=True)
25
 
26
- model.to('cuda')
27
-
28
  class KeywordsStoppingCriteria(StoppingCriteria):
29
  def __init__(self, keywords, tokenizer, input_ids):
30
  self.keywords = keywords
@@ -87,6 +85,7 @@ def bot_streaming(message, history):
87
  messages.append({"role": "user", "content": f"<image>\n{message['text']}"})
88
  elif len(history) == 0 and image is None:
89
  messages.append({"role": "user", "content": message['text'] })
 
90
 
91
  # if image is None:
92
  # gr.Error("You need to upload an image for LLaVA to work.")
 
23
  attn_implementation="flash_attention_2",
24
  trust_remote_code=True)
25
 
 
 
26
  class KeywordsStoppingCriteria(StoppingCriteria):
27
  def __init__(self, keywords, tokenizer, input_ids):
28
  self.keywords = keywords
 
85
  messages.append({"role": "user", "content": f"<image>\n{message['text']}"})
86
  elif len(history) == 0 and image is None:
87
  messages.append({"role": "user", "content": message['text'] })
88
+ model = model.to('cuda')
89
 
90
  # if image is None:
91
  # gr.Error("You need to upload an image for LLaVA to work.")