提交 22c25768 编写于 作者: W wangguanzhong 提交者: GitHub

print total config (#3300)

上级 8aa50fde
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
......@@ -151,9 +151,7 @@ def generate_config(**kwargs):
print(dump_config(s, minimal))
# FIXME this is pretty hackish, maybe implement a custom YAML printer?
def analyze_config(**kwargs):
config = load_config(kwargs['file'])
def print_total_cfg(config):
modules = get_registered_modules()
green = '___{}___'.format(color_tty.colors.index('green') + 31)
......@@ -222,6 +220,12 @@ def analyze_config(**kwargs):
print(buffer)
# FIXME this is pretty hackish, maybe implement a custom YAML printer?
def analyze_config(**kwargs):
config = load_config(kwargs['file'])
print_total_cfg(config)
if __name__ == '__main__':
argv = sys.argv[1:]
......
......@@ -33,6 +33,7 @@ set_paddle_flags(
import paddle.fluid as fluid
from tools.configure import print_total_cfg
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results, json_eval_results
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.cli import ArgsParser
......@@ -61,6 +62,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu(cfg.use_gpu)
print_total_cfg(cfg)
if 'eval_feed' not in cfg:
eval_feed = create(main_arch + 'EvalFeed')
......
......@@ -22,11 +22,13 @@ import glob
import numpy as np
from PIL import Image
def set_paddle_flags(**kwargs):
for key, value in kwargs.items():
if os.environ.get(key, None) is None:
os.environ[key] = str(value)
# NOTE(paddle-dev): All of these flags should be set before
# `import paddle`. Otherwise, it would not take any effect.
set_paddle_flags(
......@@ -35,6 +37,7 @@ set_paddle_flags(
from paddle import fluid
from tools.configure import print_total_cfg
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.modeling.model_input import create_feed
from ppdet.data.data_feed import create_reader
......@@ -147,6 +150,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu(cfg.use_gpu)
print_total_cfg(cfg)
if 'test_feed' not in cfg:
test_feed = create(main_arch + 'TestFeed')
......
......@@ -21,6 +21,7 @@ import time
import numpy as np
import datetime
from collections import deque
from tools.configure import print_total_cfg
def set_paddle_flags(**kwargs):
......@@ -36,7 +37,6 @@ set_paddle_flags(
)
from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.data.data_feed import create_reader
......@@ -66,6 +66,7 @@ def main():
# check if set use_gpu=True in paddlepaddle cpu version
check_gpu(cfg.use_gpu)
print_total_cfg(cfg)
if cfg.use_gpu:
devices_num = fluid.core.get_cuda_device_count()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册