Update app.py

#3
by andito HF staff - opened
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -10,6 +10,7 @@ import subprocess
10
 
11
 
12
  processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")
 
13
 
14
  model = AutoModelForVision2Seq.from_pretrained("HuggingFaceTB/SmolVLM-Instruct",
15
  torch_dtype=torch.bfloat16,
 
10
 
11
 
12
  processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")
13
+ processor.chat_template = """<|begin_of_text|>{% for message in messages %}{{message['role'].capitalize()}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}"""
14
 
15
  model = AutoModelForVision2Seq.from_pretrained("HuggingFaceTB/SmolVLM-Instruct",
16
  torch_dtype=torch.bfloat16,