From e2075983d9075694a5791c45301627d5c216facd Mon Sep 17 00:00:00 2001 From: wangchaochaohu Date: Wed, 19 Jun 2019 07:20:40 -0500 Subject: [PATCH] update model config for yolov3 (#2429) * update * fix --- PaddleCV/yolov3/train.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/PaddleCV/yolov3/train.py b/PaddleCV/yolov3/train.py index 5ad9a774..48c091c4 100644 --- a/PaddleCV/yolov3/train.py +++ b/PaddleCV/yolov3/train.py @@ -16,6 +16,18 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os + +def set_paddle_flags(flags): + for key, value in flags.items(): + if os.environ.get(key, None) is None: + os.environ[key] = str(value) + +set_paddle_flags({ + 'FLAGS_eager_delete_tensor_gb': 0, # enable gc + 'FLAGS_memory_fraction_of_eager_deletion': 1, + 'FLAGS_fraction_of_gpu_memory_to_use': 0.98 +}) + import sys import numpy as np import random @@ -83,7 +95,7 @@ def train(): fluid.io.load_vars(exe, cfg.pretrain, predicate=if_exist) build_strategy = fluid.BuildStrategy() - build_strategy.memory_optimize = True + build_strategy.memory_optimize = False #gc and memory optimize may conflict build_strategy.sync_batch_norm = cfg.syncbn compile_program = fluid.compiler.CompiledProgram(fluid.default_main_program( )).with_data_parallel( -- GitLab