From e5227c9f89c6cc6ea9dde73af074ab63cee557d0 Mon Sep 17 00:00:00 2001 From: alouhahaha Date: Tue, 27 Oct 2020 13:45:44 +0800 Subject: [PATCH] GPT scripts bug fix --- model_zoo/official/nlp/gpt/src/gpt_wrapcell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model_zoo/official/nlp/gpt/src/gpt_wrapcell.py b/model_zoo/official/nlp/gpt/src/gpt_wrapcell.py index 0d024fabbd..dbcb9fd436 100644 --- a/model_zoo/official/nlp/gpt/src/gpt_wrapcell.py +++ b/model_zoo/official/nlp/gpt/src/gpt_wrapcell.py @@ -26,7 +26,7 @@ from mindspore.communication.management import get_group_size from mindspore.common.tensor import Tensor import mindspore.common.dtype as mstype from mindspore.common.parameter import Parameter -from utils import ClipByGlobalNorm +from src.utils import ClipByGlobalNorm GRADIENT_CLIP_TYPE = 1 GRADIENT_CLIP_VALUE = 1.0 @@ -77,6 +77,7 @@ class GPTTrainOneStepWithLossScaleCell(nn.Cell): def __init__(self, network, optimizer, scale_update_cell=None, enable_global_norm=False): super(GPTTrainOneStepWithLossScaleCell, self).__init__(auto_prefix=False) self.network = network + self.network.add_flags(defer_inline=True) self.weights = optimizer.parameters self.optimizer = optimizer self.enable_global_norm = enable_global_norm