-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refine SE-ResNeXt model and use ParallelExecutor. #816
Conversation
momentum=0.9, | ||
regularization=fluid.regularizer.L2Decay(1e-4)) | ||
|
||
opts = optimizer.minimize(avg_cost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opts = optimizer.minimize(avg_cost)
should be placed in line 84. Because minimize
will add the backward ops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
train_loss = np.array(train_info[0]).mean() | ||
train_acc1 = np.array(train_info[1]).mean() | ||
train_acc5 = np.array(train_info[2]).mean() | ||
for data in test_reader(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing phase can be written as a function. Just advise, this is my own habit.
fluid/image_classification/train.py
Outdated
regularization=fluid.regularizer.L2Decay(1e-4)) | ||
|
||
opts = optimizer.minimize(avg_cost) | ||
fluid.memory_optimize(fluid.default_main_program()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_program
's memory also need to be optimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. But the memory_optimize
has never been tested in ParallelExecutor.
fluid/image_classification/train.py
Outdated
opts = optimizer.minimize(avg_cost) | ||
fluid.memory_optimize(fluid.default_main_program()) | ||
|
||
inference_program = fluid.default_main_program().clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inference_program should only contain the forward ops. So line 80 should be placed in line62.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. But the original code is also right.
loss, acc1, acc5 = exe.run( | ||
fluid.default_main_program(), | ||
feed=feeder.feed(data), | ||
fetch_list=[avg_cost, acc_top1, acc_top5]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetching operation is time-consuming, if possible, we can fetch data every 10 iterations.
No description provided.