Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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.")
|