Skip to content

Commit

Permalink
fix the ips of Bert in the static graph (PaddlePaddle#1518)
Browse files Browse the repository at this point in the history
* fix_ips and data sampler

* fix train_batch_sampler

* fix train_batch_sampler

* fix batch_sampler

* fix bug

Co-authored-by: Zeyu Chen <[email protected]>
  • Loading branch information
Yanxing-Shi and ZeyuChen authored Dec 30, 2021
1 parent a824222 commit e1842d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/language_model/bert/static/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create_pretraining_dataset(input_file,
places=None):
train_data = PretrainingDataset(
input_file=input_file, max_pred_length=max_pred_length)
train_batch_sampler = paddle.io.DistributedBatchSampler(
train_batch_sampler = paddle.io.BatchSampler(
train_data, batch_size=args.batch_size, shuffle=True)

def _collate_data(data, stack_fn=Stack()):
Expand Down
4 changes: 2 additions & 2 deletions examples/language_model/bert/static/run_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ def do_train(args):
% (global_step, epoch, step, loss_return[0],
reader_cost_avg.get_average(),
train_cost_avg.get_average(),
total_samples / args.logging_steps, total_samples /
(args.logging_steps * train_cost_avg.get_average())))
total_samples / args.logging_steps, args.batch_size /
(reader_cost_avg.get_average() + train_cost_avg.get_average())))
total_samples = 0
train_cost_avg.reset()
reader_cost_avg.reset()
Expand Down

0 comments on commit e1842d7

Please sign in to comment.