class ModelBert(nn.Cell): def __init__(self, network, optimizer=None): super(ModelBert, self).__init__() self.optimizer = optimizer self.train_network = BertTrainOneStepWithLossScaleCell(network, self.optimizer) self.train_network.set_train() def construct(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7): return self.train_network(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
class ModelBert(nn.Cell): def __init__(self, network, optimizer=None): super(ModelBert, self).__init__() self.optimizer = optimizer manager = DynamicLossScaleManager() update_cell = LossScaleUpdateCell(manager) self.train_network = BertTrainOneStepWithLossScaleCell(network, self.optimizer, scale_update_cell=update_cell) self.train_network.set_train() def construct(self, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7): return self.train_network(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)