未验证 提交 60e1ff60 编写于 作者: B Bin Lu 提交者: GitHub

remove gpu infer (#5530)

* remove gpu inference
上级 3ce9dd26
......@@ -25,7 +25,7 @@ train_model:./pretrain_models/mobilenet_v3_small_pretrained.pdparams
infer_export:tools/export_model.py --model=mobilenet_v3_small
##
inference:deploy/inference_python/infer.py
--use-gpu:True|False
--use-gpu:False
--batch-size:1
--model-dir:./output/mobilenet_v3_small_infer/
--img-path:./images/demo.jpg
......
......@@ -281,25 +281,26 @@ def main(args):
train_one_epoch(model, criterion, optimizer, data_loader, epoch,
args.print_freq, args.amp_level, scaler)
lr_scheduler.step()
top1 = evaluate(
model, criterion, data_loader_test, amp_level=args.amp_level)
if args.output_dir:
paddle.save(model.state_dict(),
os.path.join(args.output_dir,
'model_{}.pdparams'.format(epoch)))
paddle.save(optimizer.state_dict(),
os.path.join(args.output_dir,
'model_{}.pdopt'.format(epoch)))
paddle.save(model.state_dict(),
os.path.join(args.output_dir, 'latest.pdparams'))
paddle.save(optimizer.state_dict(),
os.path.join(args.output_dir, 'latest.pdopt'))
if top1 > best_top1:
best_top1 = top1
if paddle.distributed.get_rank() == 0:
top1 = evaluate(
model, criterion, data_loader_test, amp_level=args.amp_level)
if args.output_dir:
paddle.save(model.state_dict(),
os.path.join(args.output_dir,
'model_{}.pdparams'.format(epoch)))
paddle.save(optimizer.state_dict(),
os.path.join(args.output_dir,
'model_{}.pdopt'.format(epoch)))
paddle.save(model.state_dict(),
os.path.join(args.output_dir, 'best.pdparams'))
os.path.join(args.output_dir, 'latest.pdparams'))
paddle.save(optimizer.state_dict(),
os.path.join(args.output_dir, 'best.pdopt'))
os.path.join(args.output_dir, 'latest.pdopt'))
if top1 > best_top1:
best_top1 = top1
paddle.save(model.state_dict(),
os.path.join(args.output_dir, 'best.pdparams'))
paddle.save(optimizer.state_dict(),
os.path.join(args.output_dir, 'best.pdopt'))
if args.pact_quant:
input_spec = [InputSpec(shape=[None, 3, 224, 224], dtype='float32')]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册