Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIPC]Fix dy2st tipc gpt 8 error #3586

Merged
merged 3 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/language_model/gpt-3/dygraph/run_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ def do_train(args):
# and add it to 'paddle.amp.decorate'
multi_precision=args.use_pure_fp16)

# decorate @to_static for benchmark, skip it by default.
if args.to_static:
specs = None
model = paddle.jit.to_static(model, input_spec=specs)
logger.info(
"Successfully to apply @to_static with specs: {}".format(specs))

if args.use_pure_fp16:
scaler = paddle.amp.GradScaler(init_loss_scaling=args.scale_loss)
# level O2 means converting the network to FP16
Expand Down Expand Up @@ -301,13 +308,6 @@ def do_train(args):
logger.warning("No optimizer checkpoint file found in %s." %
opt_path)

# decorate @to_static for benchmark, skip it by default.
if args.to_static:
specs = None
model = paddle.jit.to_static(model, input_spec=specs)
logger.info(
"Successfully to apply @to_static with specs: {}".format(specs))

global_step = 0
tic_train = time.time()
for epoch in range(args.num_train_epochs):
Expand Down
3 changes: 2 additions & 1 deletion examples/machine_translation/transformer/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ def do_train(args):
args.unk_token = ARGS.unk_token
args.bos_token = ARGS.bos_token
args.eos_token = ARGS.eos_token
args.to_static = ARGS.to_static
if ARGS.to_static:
args.to_static = ARGS.to_static
args.device = ARGS.device
pprint(args)

Expand Down
14 changes: 7 additions & 7 deletions model_zoo/gpt/run_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ def do_train(args):
# Create the critrion for the gpt model
criterion = GPTPretrainingCriterion()

# decorate @to_static for benchmark, skip it by default.
if args.to_static:
specs = None
model = paddle.jit.to_static(model, input_spec=specs)
logger.info(
"Successfully to apply @to_static with specs: {}".format(specs))

if paddle.distributed.get_world_size() > 1:
model = paddle.DataParallel(model)

Expand Down Expand Up @@ -201,13 +208,6 @@ def do_train(args):
logger.warning("No optimizer checkpoint file found in %s." %
opt_path)

# decorate @to_static for benchmark, skip it by default.
if args.to_static:
specs = None
model = paddle.jit.to_static(model, input_spec=specs)
logger.info(
"Successfully to apply @to_static with specs: {}".format(specs))

global_step = 0
epoch = 0
tic_train = time.time()
Expand Down