mindformers.core

MindFormers Core.

mindformers.core

mindformers.core.build_context

Build context.

mindformers.core.init_context

Context initialization for MindSpore. Args: use_parallel (Optional[Union[bool]]): Whether to use distributed training. Default: False. context_config (Optional[Union[dict, ContextConfig]]): Context Config For Running Environment. Default: None. parallel_config (Optional[Union[dict, ParallelContextConfig]]): Parallel Config For Running Environment. Default: None.

mindformers.core.callback

mindformers.core.callback.CheckpointMointor

Checkpoint Monitor For Save LossScale.

mindformers.core.callback.MFLossMonitor

Loss Monitor for classification.

mindformers.core.callback.ObsMonitor

Obs Monitor For Local and AICC.

mindformers.core.callback.SummaryMonitor

Summary Monitor For AICC and Local.

mindformers.core.callback.ProfileMonitor

Profile analysis in training.

mindformers.core.callback.EvalCallBack

Evaluate Callback used in training progress.

mindformers.core.loss

mindformers.core.loss.CrossEntropyLoss

Calculate the cross entropy loss.

mindformers.core.loss.L1Loss

L1Loss for parallel.

mindformers.core.loss.MSELoss

Calculate the MSE loss with given logits and labels.

mindformers.core.loss.SoftTargetCrossEntropy

Calculate the SoftTargetCrossEntropy loss with given logits and labels.

mindformers.core.lr

mindformers.core.lr.ConstantWarmUpLR

Constant Warm Up Learning Rate.

mindformers.core.lr.CosineWithRestartsAndWarmUpLR

Cosine with Restarts and Warm Up Learning Rate.

mindformers.core.lr.CosineWithWarmUpLR

Cosine with Warm Up Learning Rate.

mindformers.core.lr.LinearWithWarmUpLR

Linear with Warm Up Learning Rate.

mindformers.core.lr.PolynomialWithWarmUpLR

Polynomial with Warm Up Learning Rate.

mindformers.core.lr.CosineAnnealingLR

Set the learning rate of each parameter group using a cosine annealing schedule, where \(\eta_{max}\) is set to the initial lr and \(T_{cur}\) is the number of epochs since the last restart in SGDR:

mindformers.core.lr.CosineAnnealingWarmRestarts

Set the learning rate of each parameter group using a cosine annealing schedule, where \(\eta_{max}\) is set to the initial lr, \(T_{cur}\) is the number of epochs since the last restart and \(T_{i}\) is the number of epochs between two warm restarts in SGDR:

mindformers.core.metric

mindformers.core.metric.EntityScore

Compute the f1, precision and recall score of each entity

mindformers.core.metric.SQuADMetric

Compute the f1, precision and recall score of each entity

mindformers.core.metric.PerplexityMetric

Compute the loss and PPL of each entity

mindformers.core.metric.ADGENMetric

Compute the f1, precision and recall score of each entity

mindformers.core.optim

mindformers.core.optim.FP32StateAdamWeightDecay

This class is almost same with the mindspore's AdamWeightDecay implements, the