@@ -133,10 +133,7 @@ def stop_tokens(self, tokenizer: "Tokenizer") -> Tuple[List[int], ...]:
133
133
134
134
class Falcon (PromptStyle ):
135
135
def apply (self , prompt : str , ** kwargs : str ) -> str :
136
- # First line could be modified. AFAIK Falcon doesn't impose a specific system prompt
137
- # The instruction to not prefix its replies doesn't work always, but better than nothing
138
- # I've also tried just "{prompt}\n" but the model seems to ramble more often
139
- return f"Do not prefix your replies with 'Bot: '\n User: { prompt } \n "
136
+ return f"{ prompt } \n Answer:"
140
137
141
138
def stop_tokens (self , tokenizer : "Tokenizer" ) -> Tuple [List [int ], ...]:
142
139
return (
@@ -218,14 +215,14 @@ def apply(self, prompt: Union[str, List[Dict[str, str]]], **kwargs: str) -> str:
218
215
219
216
def encode_header (role : str ) -> List [str ]:
220
217
return [f"<|start_header_id|>{ role } <|end_header_id|>\n \n " ]
221
-
218
+
222
219
def encode_message (message : Dict [str , str ]) -> List [str ]:
223
220
tokens = encode_header (message ["role" ])
224
221
# NOTE: Meta stripped this. I'm not sure I agree, but who am I to argue?
225
222
tokens .append (message ["content" ].strip ())
226
223
tokens .append ("<|eot_id|>" )
227
224
return tokens
228
-
225
+
229
226
def has_system_prompt (messages : List [Dict [str , str ]]) -> bool :
230
227
return messages [0 ].get ("role" , "" ) == "system" if len (messages ) else False
231
228
@@ -309,7 +306,6 @@ def apply(self, prompt: str, **kwargs: str) -> str:
309
306
return f'<|system|>\n You are a helpful assistant.<|end|>\n <|user|>\n { prompt } <|end|>\n <|assistant|>\n '
310
307
311
308
312
-
313
309
class TinyLlama (PromptStyle ):
314
310
def apply (self , prompt : str , ** kwargs : str ) -> str :
315
311
return (
0 commit comments