MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / __init__

Method __init__

codegeex/mindspore/src/callbacks.py:102–121  ·  view source on GitHub ↗
(self, model, eval_dataset, ppl_metric, validation_loss, print_per_step=250, has_trained_step=0,
                 local_rank=0, rank_size=1, tb_writer=None, lang=None)

Source from the content-addressed store, hash-verified

100 """
101
102 def __init__(self, model, eval_dataset, ppl_metric, validation_loss, print_per_step=250, has_trained_step=0,
103 local_rank=0, rank_size=1, tb_writer=None, lang=None):
104 super(EvalCallBack, self).__init__()
105 if not isinstance(print_per_step, int) or print_per_step < 0:
106 raise ValueError("print_per_step must be int and >= 0.")
107 self.print_per_step = print_per_step
108 self.model = model
109 self.eval_dataset = eval_dataset
110 self.pplMetric = ppl_metric
111 self.validation_loss = validation_loss
112 self.has_trained_step = has_trained_step
113 self.local_rank = local_rank
114 self.rank_size = rank_size
115 self.pplMetric.clear()
116 self.validation_loss.clear()
117 self.parallel_mode = context.get_auto_parallel_context("parallel_mode")
118 self.strategy_ckpt_save_file = context.get_auto_parallel_context("strategy_ckpt_save_file")
119 self.strategy_ckpt_load_file = context.get_auto_parallel_context("strategy_ckpt_load_file")
120 self.summary_writer = tb_writer
121 self.lang = lang
122
123 def step_end(self, run_context):
124 """

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
clearMethod · 0.45

Tested by

no test coverage detected