MCPcopy Create free account
hub / github.com/FreedomIntelligence/CMB / __init__

Method __init__

workers/base.py:254–274  ·  view source on GitHub ↗
(
            self, 
            tokenizer, 
            instruction_template, 
            conv_collater,
            use_cot=False
    )

Source from the content-addressed store, hash-verified

252
253class 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):

Callers

nothing calls this directly

Calls 1

get_question_templateMethod · 0.95

Tested by

no test coverage detected