merve HF staff commited on
Commit
c18188c
1 Parent(s): 44e1de1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -10,8 +10,7 @@ import subprocess
10
 
11
 
12
  processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")
13
- processor.chat_template = "{'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,
17
  #_attn_implementation="flash_attention_2"
 
10
 
11
 
12
  processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")
13
+ processor.chat_template = "{'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
  model = AutoModelForVision2Seq.from_pretrained("HuggingFaceTB/SmolVLM-Instruct",
15
  torch_dtype=torch.bfloat16,
16
  #_attn_implementation="flash_attention_2"