Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import
|
| 3 |
import torch
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
model_path = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
|
| 6 |
processor = AutoProcessor.from_pretrained(model_path)
|
| 7 |
-
model = AutoModelForImageTextToText.from_pretrained(
|
| 8 |
-
model_path,
|
| 9 |
-
torch_dtype=torch.bfloat16,
|
| 10 |
-
_attn_implementation="flash_attention_2"
|
| 11 |
-
).to("cuda")
|
| 12 |
|
| 13 |
def launch(input):
|
| 14 |
out = model.generate(**input)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForImageTextToText
|
| 3 |
import torch
|
| 4 |
|
| 5 |
+
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")
|
| 6 |
+
model = AutoModelForImageTextToText.from_pretrained("HuggingFaceTB/SmolVLM2-2.2B-Instruct")
|
| 7 |
+
|
| 8 |
model_path = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
|
| 9 |
processor = AutoProcessor.from_pretrained(model_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def launch(input):
|
| 12 |
out = model.generate(**input)
|