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

change duration compute methods #49

Merged
merged 8 commits into from
Jan 19, 2018
Merged

change duration compute methods #49

merged 8 commits into from
Jan 19, 2018

Conversation

ccmeteorljh
Copy link

1,、修改了duration的计算方法,原来的是统计了最后一个pass的时间,但是计算examples_per_sec时im_num缺失所有pass的图片总和,现在修改duration为所有pass的时间总和;
2、skip_batch_num这个参数没有起到作用,现在修改了

@@ -195,9 +199,9 @@ def run_benchmark(model, args):
im_num += label.shape[0]

duration = time.time() - start_time
im_num = im_num - args.skip_batch_num * args.batch_size
#im_num = im_num - args.skip_batch_num * args.batch_size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please delete the codes commented

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if iter < args.skip_batch_num:
iter += 1
continue
if pass_id == 0:
start_time = time.time()
Copy link
Contributor

@ranqiu92 ranqiu92 Jan 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all batches in pass 0, this line will be executed. Is this what you want?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

Copy link
Contributor

@ranqiu92 ranqiu92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accuracy.reset(exe)
if iter == args.iterations:
break
iter = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this modification right? What's the use of args.iterations ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it shoud be:
accuracy.reset(exe)
iter = 0
the args.iterations is used to limit the iterations in each pass, so it used in:
for batch_id, data in enumerate(train_reader()):

@@ -198,7 +198,7 @@ def run_benchmark(model, args):
buf_size=5120),
batch_size=args.batch_size)

place = core.CPUPlace() if args.device == 'CPU' else core.CUDAPlace(0)
place = core.CPUPlace() if args.device == 'CPU' else core.GPUPlace(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember CUDAPlace is used in the latest PaddlePaddle. Could you refer to the source codes to confirm this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

im_num = 0
start_time = time.time()
for pass_id in range(args.pass_num):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Owner

@dzhwinter dzhwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

@dzhwinter dzhwinter merged commit 2cc7a1e into dzhwinter:master Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants