@@ -401,7 +401,6 @@ def build_all_requests(
401401 fewshot_as_multiturn : bool = False ,
402402 chat_template : Optional [Callable ] = None ,
403403 tokenizer_name : str = "" ,
404- question_suffix : str = "" ,
405404 ) -> None :
406405 """Build a set of Instances for a task, and store them in task.instances"""
407406
@@ -465,7 +464,6 @@ def build_all_requests(
465464 fewshot_as_multiturn ,
466465 chat_template ,
467466 gen_prefix = self .doc_to_prefix (doc ),
468- question_suffix = question_suffix ,
469467 )
470468
471469 # TODO: we should override self.config.repeats if doing greedy gen so users don't waste time+compute
@@ -1068,7 +1066,6 @@ def append_target_question(
10681066 question : str ,
10691067 fewshot_as_multiturn : bool = False ,
10701068 gen_prefix : Optional [str ] = None ,
1071- question_suffix : Optional [str ] = None ,
10721069 ) -> None :
10731070 """Adds a target question to the labeled examples list.
10741071 If fewshot_as_multiturn is True, or labeled_examples is empty, or the last entry is a system turn, appends the question as a new user entry.
@@ -1077,23 +1074,13 @@ def append_target_question(
10771074 if not fewshot_as_multiturn :
10781075 # if no messages or last message is system, append as new user entry
10791076 if len (labeled_examples ) == 0 or labeled_examples [- 1 ]["role" ] == "system" :
1080- labeled_examples .append (
1081- {"role" : "user" , "content" : question + question_suffix }
1082- if question_suffix
1083- else {"role" : "user" , "content" : question }
1084- )
1077+ labeled_examples .append ({"role" : "user" , "content" : question })
10851078 # if last message is user, append to it to avoid two user messages in a row
10861079 else :
1087- labeled_examples [- 1 ]["content" ] += (
1088- question + question_suffix if question_suffix else question
1089- )
1080+ labeled_examples [- 1 ]["content" ] += question
10901081 else :
10911082 # if fewshot_as_multiturn is True, append as next user entry (last is always assistant)
1092- labeled_examples .append (
1093- {"role" : "user" , "content" : question + question_suffix }
1094- if question_suffix
1095- else {"role" : "user" , "content" : question }
1096- )
1083+ labeled_examples .append ({"role" : "user" , "content" : question })
10971084 if gen_prefix :
10981085 labeled_examples .append ({"role" : "assistant" , "content" : gen_prefix })
10991086
@@ -1107,7 +1094,6 @@ def fewshot_context(
11071094 fewshot_as_multiturn : bool = False ,
11081095 chat_template : Optional [Callable ] = None ,
11091096 gen_prefix : Optional [str ] = None ,
1110- question_suffix : Optional [str ] = None ,
11111097 ) -> Union [str , List [str ]]:
11121098 """Returns a fewshot context string that is made up of a prepended description
11131099 (if provided), the `num_fewshot` number of examples, and an appended prompt example.
@@ -1185,7 +1171,6 @@ def fewshot_context(
11851171 example ,
11861172 fewshot_as_multiturn ,
11871173 gen_prefix = gen_prefix ,
1188- question_suffix = question_suffix ,
11891174 )
11901175 # for loglikelihood create a list of questions with appended choices
11911176 elif isinstance (example , list ):
@@ -1198,7 +1183,6 @@ def fewshot_context(
11981183 ex ,
11991184 fewshot_as_multiturn ,
12001185 gen_prefix = gen_prefix ,
1201- question_suffix = question_suffix ,
12021186 )
12031187 # TODO: append prefill?
12041188 labeled_examples_list .append (
@@ -1217,15 +1201,13 @@ def fewshot_context(
12171201 choices [example ],
12181202 fewshot_as_multiturn ,
12191203 gen_prefix = gen_prefix ,
1220- question_suffix = question_suffix ,
12211204 )
12221205 else :
12231206 self .append_target_question (
12241207 labeled_examples ,
12251208 str (example ),
12261209 fewshot_as_multiturn ,
12271210 gen_prefix = gen_prefix ,
1228- question_suffix = question_suffix ,
12291211 )
12301212 # return lm.apply_chat_template(labeled_examples)
12311213 return chat_template (
0 commit comments