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

Method __post_init__

workers/base.py:33–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

31 use_fewshot: bool = False,
32
33 def __post_init__(self):
34 if self.generate_fewshot_examples_only: # no need to do post_init if we only need to generate fewshot examples
35 return
36 self.print_in_main(f'loading config: {self.cfg.load}')
37 self.model, self.tokenizer = self.load_model_and_tokenizer(self.cfg.load)
38 self.device = self.cfg.load.device
39 self.accelerator = Accelerator()
40 self.prompt_wrapper = PromptWrapper(
41 self.tokenizer,
42 self.instruction_template_with_fewshot if self.use_fewshot else self.instruction_template,
43 conv_collater=self.collate_conv,
44 use_cot=self.use_cot,
45 )
46 self.wrap_model()
47 self.init_generation_config(self.cfg)
48 self.init_dataloader(self.input_pth, self.batch_size)
49 self.init_writer(self.output_pth)
50
51
52 @classmethod

Callers

nothing calls this directly

Calls 7

print_in_mainMethod · 0.95
wrap_modelMethod · 0.95
init_dataloaderMethod · 0.95
init_writerMethod · 0.95
PromptWrapperClass · 0.85

Tested by

no test coverage detected