Пример #1
0
 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()
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
 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()