当前位置: 首页>>代码示例>>Python>>正文


Python configargparse.ArgumentDefaultsHelpFormatter方法代码示例

本文整理汇总了Python中configargparse.ArgumentDefaultsHelpFormatter方法的典型用法代码示例。如果您正苦于以下问题:Python configargparse.ArgumentDefaultsHelpFormatter方法的具体用法?Python configargparse.ArgumentDefaultsHelpFormatter怎么用?Python configargparse.ArgumentDefaultsHelpFormatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configargparse的用法示例。


在下文中一共展示了configargparse.ArgumentDefaultsHelpFormatter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_args

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def parse_args():
    parser = configargparse.ArgumentParser(
        description='preprocess.py',
        config_file_parser_class=configargparse.YAMLConfigFileParser,
        formatter_class=configargparse.ArgumentDefaultsHelpFormatter)

    opts.config_opts(parser)
    opts.add_md_help_argument(parser)
    opts.preprocess_opts(parser)

    opt = parser.parse_args()
    torch.manual_seed(opt.seed)

    check_existing_pt_files(opt)

    return opt 
开发者ID:lizekang,项目名称:ITDD,代码行数:18,代码来源:preprocess.py

示例2: __init__

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def __init__(self, *args, **kwargs):
        self._PARSED = False
        self.work_dir = os.path.join(os.path.expanduser('~'), 'nervana')
        if 'default_config_files' not in kwargs:
            kwargs['default_config_files'] = [os.path.join(self.work_dir, 'neon.cfg')]
        if 'add_config_file_help' not in kwargs:
            # turn off the auto-generated config help for config files since it
            # referenced unsettable config options like --version
            kwargs['add_config_file_help'] = False

        self.defaults = kwargs.pop('default_overrides', dict())
        super(NgraphArgparser, self).__init__(*args, **kwargs)

        # ensure that default values are display via --help
        self.formatter_class = configargparse.ArgumentDefaultsHelpFormatter

        self.setup_default_args() 
开发者ID:NervanaSystems,项目名称:ngraph-python,代码行数:19,代码来源:argparser.py

示例3: __init__

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def __init__(self, *args, **kwargs):
        self._PARSED = False
        self.work_dir = os.path.join(os.path.expanduser('~'), 'nervana')
        if 'default_config_files' not in kwargs:
            kwargs['default_config_files'] = [os.path.join(self.work_dir,
                                                           'neon.cfg')]
        if 'add_config_file_help' not in kwargs:
            # turn off the auto-generated config help for config files since it
            # referenced unsettable config options like --version
            kwargs['add_config_file_help'] = False

        self.defaults = kwargs.pop('default_overrides', dict())
        super(NeonArgparser, self).__init__(*args, **kwargs)

        # ensure that default values are display via --help
        self.formatter_class = configargparse.ArgumentDefaultsHelpFormatter

        self.setup_default_args() 
开发者ID:NervanaSystems,项目名称:neon,代码行数:20,代码来源:argparser.py

示例4: get_parser

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def get_parser():
    parser = configargparse.ArgumentParser(
        description='generate RST from argparse options',
        config_file_parser_class=configargparse.YAMLConfigFileParser,
        formatter_class=configargparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('src', type=str, nargs='+',
                        help='source python files that contain get_parser() func')
    return parser


# parser 
开发者ID:espnet,项目名称:espnet,代码行数:13,代码来源:argparse2rst.py

示例5: __init__

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def __init__(
            self,
            config_file_parser_class=cfargparse.YAMLConfigFileParser,
            formatter_class=cfargparse.ArgumentDefaultsHelpFormatter,
            **kwargs):
        super(ArgumentParser, self).__init__(
            config_file_parser_class=config_file_parser_class,
            formatter_class=formatter_class,
            **kwargs) 
开发者ID:harvardnlp,项目名称:encoder-agnostic-adaptation,代码行数:11,代码来源:parse.py

示例6: get_parser

# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import ArgumentDefaultsHelpFormatter [as 别名]
def get_parser():
    """Get parser of decoding arguments."""
    parser = configargparse.ArgumentParser(
        description='Synthesize speech from text using a TTS model on one CPU',
        config_file_parser_class=configargparse.YAMLConfigFileParser,
        formatter_class=configargparse.ArgumentDefaultsHelpFormatter)
    # general configuration
    parser.add('--config', is_config_file=True, help='config file path')
    parser.add('--config2', is_config_file=True,
               help='second config file path that overwrites the settings in `--config`.')
    parser.add('--config3', is_config_file=True,
               help='third config file path that overwrites the settings in `--config` and `--config2`.')

    parser.add_argument('--ngpu', default=0, type=int,
                        help='Number of GPUs')
    parser.add_argument('--backend', default='pytorch', type=str,
                        choices=['chainer', 'pytorch'],
                        help='Backend library')
    parser.add_argument('--debugmode', default=1, type=int,
                        help='Debugmode')
    parser.add_argument('--seed', default=1, type=int,
                        help='Random seed')
    parser.add_argument('--out', type=str, required=True,
                        help='Output filename')
    parser.add_argument('--verbose', '-V', default=0, type=int,
                        help='Verbose option')
    parser.add_argument('--preprocess-conf', type=str, default=None,
                        help='The configuration file for the pre-processing')
    # task related
    parser.add_argument('--json', type=str, required=True,
                        help='Filename of train label data (json)')
    parser.add_argument('--model', type=str, required=True,
                        help='Model file parameters to read')
    parser.add_argument('--model-conf', type=str, default=None,
                        help='Model config file')
    # decoding related
    parser.add_argument('--maxlenratio', type=float, default=5,
                        help='Maximum length ratio in decoding')
    parser.add_argument('--minlenratio', type=float, default=0,
                        help='Minimum length ratio in decoding')
    parser.add_argument('--threshold', type=float, default=0.5,
                        help='Threshold value in decoding')
    parser.add_argument('--use-att-constraint', type=strtobool, default=False,
                        help='Whether to use the attention constraint')
    parser.add_argument('--backward-window', type=int, default=1,
                        help='Backward window size in the attention constraint')
    parser.add_argument('--forward-window', type=int, default=3,
                        help='Forward window size in the attention constraint')
    # save related
    parser.add_argument('--save-durations', default=False, type=strtobool,
                        help='Whether to save durations converted from attentions')
    parser.add_argument('--save-focus-rates', default=False, type=strtobool,
                        help='Whether to save focus rates of attentions')
    return parser 
开发者ID:DigitalPhonetics,项目名称:adviser,代码行数:56,代码来源:tts_decode.py


注:本文中的configargparse.ArgumentDefaultsHelpFormatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。