options.py 2.4 KB
Newer Older
Q
qingqing01 已提交
1
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
L
lijianshe02 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# 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.

L
LielinJiang 已提交
15 16
import argparse

L
lijianshe02 已提交
17

L
LielinJiang 已提交
18
def parse_args():
L
LielinJiang 已提交
19
    parser = argparse.ArgumentParser(description='PaddleGAN')
L
LielinJiang 已提交
20 21
    parser.add_argument('-c',
                        '--config-file',
L
lijianshe02 已提交
22
                        metavar="FILE",
L
LielinJiang 已提交
23 24
                        help='config file path')
    # cuda setting
L
lijianshe02 已提交
25 26 27
    parser.add_argument('--no-cuda',
                        action='store_true',
                        default=False,
L
LielinJiang 已提交
28 29
                        help='disables CUDA training')
    # checkpoint and log
L
lijianshe02 已提交
30 31 32
    parser.add_argument('--resume',
                        type=str,
                        default=None,
L
LielinJiang 已提交
33
                        help='put the path to resuming file if needed')
L
lijianshe02 已提交
34 35 36
    parser.add_argument('--load',
                        type=str,
                        default=None,
L
LielinJiang 已提交
37 38
                        help='put the path to resuming file if needed')
    # for evaluation
L
lijianshe02 已提交
39 40 41
    parser.add_argument('--val-interval',
                        type=int,
                        default=1,
L
LielinJiang 已提交
42
                        help='run validation every interval')
L
lijianshe02 已提交
43 44 45
    parser.add_argument('--evaluate-only',
                        action='store_true',
                        default=False,
L
LielinJiang 已提交
46 47
                        help='skip validation during training')
    # config options
农夫三拳_'s avatar
农夫三拳_ 已提交
48 49 50 51
    parser.add_argument("-o", 
                        "--opt", 
                        nargs='+', 
                        help="set configuration options")
L
lijianshe02 已提交
52 53 54 55 56 57 58 59 60

    #for inference
    parser.add_argument("--source_path",
                        default="",
                        metavar="FILE",
                        help="path to source image")
    parser.add_argument("--reference_dir",
                        default="",
                        help="path to reference images")
L
lijianshe02 已提交
61
    parser.add_argument("--model_path", default=None, help="model for loading")
L
lijianshe02 已提交
62

L
LielinJiang 已提交
63 64
    args = parser.parse_args()

L
lijianshe02 已提交
65
    return args