(
self,
tokenizer,
instruction_template,
conv_collater,
use_cot=False
)
| 252 | |
| 253 | class PromptWrapper(): |
| 254 | def __init__( |
| 255 | self, |
| 256 | tokenizer, |
| 257 | instruction_template, |
| 258 | conv_collater, |
| 259 | use_cot=False |
| 260 | ): |
| 261 | |
| 262 | self.instruction_template = instruction_template |
| 263 | |
| 264 | self.question_template = self.get_question_template(use_cot=use_cot) |
| 265 | |
| 266 | if '{fewshot_examples}' in self.instruction_template: |
| 267 | # use fewshot examples |
| 268 | # keep the fewshot placeholder, since examples are sample-specific |
| 269 | self.input_template = self.instruction_template.format(instruction=self.question_template, fewshot_examples='{fewshot_examples}') |
| 270 | else: |
| 271 | self.input_template = self.instruction_template.format(instruction=self.question_template) |
| 272 | |
| 273 | self.conv_collater = conv_collater # for multi-turn QA only, implemented for each model |
| 274 | self.tokenizer = tokenizer |
| 275 | |
| 276 | |
| 277 | def get_system_template(self, t): |
nothing calls this directly
no test coverage detected