preston-cell commited on
Commit
0fba986
·
verified ·
1 Parent(s): 40c03fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,14 +1,12 @@
1
  import gradio as gr
2
- from transformers import AutoProcessor, AutoModelForImageTextToText
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)