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

Method construct

codegeex/mindspore/src/utils.py:261–275  ·  view source on GitHub ↗

dynamic learning rate

(self, global_step)

Source from the content-addressed store, hash-verified

259 self.use_cosine = use_cosine
260
261 def construct(self, global_step):
262 """dynamic learning rate"""
263 if not self.use_cosine:
264 decay_lr = self.decay_lr(global_step)
265 else:
266 decay_lr = self.cosine_decay_lr(global_step)
267 if self.warmup_flag:
268 is_warmup = self.cast(self.greater(self.warmup_steps, global_step),
269 mstype.float32)
270 warmup_lr = self.warmup_lr(global_step)
271 lr = (self.one - is_warmup) * decay_lr + is_warmup * warmup_lr
272 else:
273 lr = decay_lr
274 # self.print(f"Learning rate: {lr.asnumpy().tolist()}")
275 return lr
276
277
278def add_inference_params(opt):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected