Update README.md
Browse files
README.md
CHANGED
@@ -60,7 +60,7 @@ Assistant:
|
|
60 |
If you need to manually set the chat template:
|
61 |
|
62 |
```
|
63 |
-
IDEFICS2_CHAT_TEMPLATE = "
|
64 |
```
|
65 |
|
66 |
### Sample inference code
|
@@ -94,7 +94,7 @@ See section towards the end for more comments on model optimization, including q
|
|
94 |
If you need to manually set the chat template:
|
95 |
|
96 |
```python
|
97 |
-
IDEFICS2_CHAT_TEMPLATE = "
|
98 |
tokenizer = AutoTokenizer.from_pretrained(base_model_id, use_fast=True)
|
99 |
tokenizer.chat_template = IDEFICS2_CHAT_TEMPLATE
|
100 |
processor.tokenizer = tokenizer
|
|
|
60 |
If you need to manually set the chat template:
|
61 |
|
62 |
```
|
63 |
+
IDEFICS2_CHAT_TEMPLATE = "{% 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 %}"
|
64 |
```
|
65 |
|
66 |
### Sample inference code
|
|
|
94 |
If you need to manually set the chat template:
|
95 |
|
96 |
```python
|
97 |
+
IDEFICS2_CHAT_TEMPLATE = "{% 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 %}"
|
98 |
tokenizer = AutoTokenizer.from_pretrained(base_model_id, use_fast=True)
|
99 |
tokenizer.chat_template = IDEFICS2_CHAT_TEMPLATE
|
100 |
processor.tokenizer = tokenizer
|