|
73 | 73 | "When task_mode is pairwise, lamda is the threshold for calculating the accuracy."
|
74 | 74 | )
|
75 | 75 |
|
76 |
| -parser.add_argument('--enable_ce', action='store_true', help='If set, run the task with continuous evaluation logs.') |
| 76 | +parser.add_argument( |
| 77 | + '--enable_ce', |
| 78 | + action='store_true', |
| 79 | + help='If set, run the task with continuous evaluation logs.') |
77 | 80 |
|
78 | 81 | args = parser.parse_args()
|
79 | 82 |
|
@@ -280,9 +283,9 @@ def valid_and_test(program, feeder, reader, process, mode="test"):
|
280 | 283 | except:
|
281 | 284 | logging.info("ce info err!")
|
282 | 285 | print("kpis\teach_step_duration_%s_card%s\t%s" %
|
283 |
| - (args.task_name, card_num, ce_time)) |
| 286 | + (args.task_name, card_num, ce_time)) |
284 | 287 | print("kpis\ttrain_loss_%s_card%s\t%f" %
|
285 |
| - (args.task_name, card_num, ce_loss)) |
| 288 | + (args.task_name, card_num, ce_loss)) |
286 | 289 |
|
287 | 290 | if args.do_test:
|
288 | 291 | if args.task_mode == "pairwise":
|
@@ -454,6 +457,15 @@ def main(conf_dict, args):
|
454 | 457 |
|
455 | 458 | if __name__ == "__main__":
|
456 | 459 | utils.print_arguments(args)
|
| 460 | + try: |
| 461 | + if fluid.is_compiled_with_cuda() != True and args.use_cuda == True: |
| 462 | + print( |
| 463 | + "\nYou can not set use_cuda = True in the model because you are using paddlepaddle-cpu.\nPlease: 1. Install paddlepaddle-gpu to run your models on GPU or 2. Set use_cuda = False to run models on CPU.\n" |
| 464 | + ) |
| 465 | + |
| 466 | + sys.exit(1) |
| 467 | + except Exception as e: |
| 468 | + pass |
457 | 469 | utils.init_log("./log/TextSimilarityNet")
|
458 | 470 | conf_dict = config.SimNetConfig(args)
|
459 | 471 | main(conf_dict, args)
|
0 commit comments