@@ -85,7 +85,7 @@ def __init__(self, tokenizer):
85
85
def encode_dialog_prompt (
86
86
self ,
87
87
dialog : DIALOG_TYPE ,
88
- add_generation_prompt : bool ,
88
+ add_generation_prompt : bool = True ,
89
89
) -> List [int ]:
90
90
"""Encode a sequence of messages into a sequence of token IDs, including
91
91
the chat template
@@ -136,7 +136,7 @@ def _encode_message(self, message: _ChatFormatter.MESSAGE_TYPE) -> List[int]:
136
136
def encode_dialog_prompt (
137
137
self ,
138
138
dialog : _ChatFormatter .DIALOG_TYPE ,
139
- add_generation_prompt : bool ,
139
+ add_generation_prompt : bool = True ,
140
140
) -> List [int ]:
141
141
tokens = []
142
142
tokens .append (self .tokenizer .special_tokens ["<|begin_of_text|>" ])
@@ -166,7 +166,7 @@ def _get_content_str(message: _ChatFormatter.MESSAGE_TYPE) -> str:
166
166
def encode_dialog_prompt (
167
167
self ,
168
168
dialog : _ChatFormatter .DIALOG_TYPE ,
169
- add_generation_prompt : bool , # UNUSED
169
+ add_generation_prompt : bool = True , # UNUSED
170
170
) -> List [int ]:
171
171
new_turn = True
172
172
tokens = []
@@ -197,7 +197,7 @@ class HFTokenizerChatFormatter(_ChatFormatter):
197
197
def encode_dialog_prompt (
198
198
self ,
199
199
dialog : _ChatFormatter .DIALOG_TYPE ,
200
- add_generation_prompt : bool ,
200
+ add_generation_prompt : bool = True ,
201
201
) -> List [int ]:
202
202
rendered = self .tokenizer .apply_chat_template (
203
203
dialog , add_generation_prompt = add_generation_prompt
0 commit comments