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


Python models.get_option_setter方法代码示例

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


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

示例1: gather_options

# 需要导入模块: import models [as 别名]
# 或者: from models import get_option_setter [as 别名]
def gather_options(self):
        # initialize parser with basic options
        if not self.initialized:
            parser = argparse.ArgumentParser(
                formatter_class=argparse.ArgumentDefaultsHelpFormatter)
            parser = self.initialize(parser)

        # get the basic options
        opt, _ = parser.parse_known_args()

        # modify model-related parser options
        model_name = opt.model
        model_option_setter = models.get_option_setter(model_name)
        parser = model_option_setter(parser, self.isTrain)
        opt, _ = parser.parse_known_args()  # parse again with the new defaults

        # modify dataset-related parser options
        dataset_name = opt.dataset_mode
        dataset_option_setter = data.get_option_setter(dataset_name)
        parser = dataset_option_setter(parser, self.isTrain)

        self.parser = parser

        return parser.parse_args() 
开发者ID:richzhang,项目名称:colorization-pytorch,代码行数:26,代码来源:base_options.py

示例2: gather_options

# 需要导入模块: import models [as 别名]
# 或者: from models import get_option_setter [as 别名]
def gather_options(self):
        # get the basic options
        opt, _ = self.parser.parse_known_args()

        # load task module and task-specific options
        task_name = opt.task
        task_options = importlib.import_module("{}.options.task_options".format(task_name))  # must be defined in each task folder
        self.parser = argparse.ArgumentParser(parents=[self.parser, task_options.TaskOptions().parser])
        opt, _ = self.parser.parse_known_args()

        # modify model-related parser options
        model_name = opt.model
        model_option_setter = models.get_option_setter(model_name, task_name)
        parser = model_option_setter(self.parser, self.is_train)
        opt, _ = parser.parse_known_args()  # parse again with the new defaults

        # modify dataset-related parser options fsldkn
        dataset_name = opt.dataset_name
        print(dataset_name, task_name)
        dataset_option_setter = data.get_option_setter(dataset_name, task_name)
        parser = dataset_option_setter(parser, self.is_train)

        self.parser = parser

        return parser.parse_args() 
开发者ID:oxai,项目名称:deepsaber,代码行数:27,代码来源:base_options.py

示例3: gather_options

# 需要导入模块: import models [as 别名]
# 或者: from models import get_option_setter [as 别名]
def gather_options(self):
        """Initialize our parser with basic options(only once).
        Add additional model-specific and dataset-specific options.
        These options are defined in the <modify_commandline_options> function
        in model and dataset classes.
        """
        if not self.initialized:  # check if it has been initialized
            parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
            parser = self.initialize(parser)

        # get the basic options
        opt, _ = parser.parse_known_args()

        # modify model-related parser options
        model_name = opt.model
        model_option_setter = models.get_option_setter(model_name)
        parser = model_option_setter(parser, self.isTrain)
        opt, _ = parser.parse_known_args()  # parse again with new defaults

        # modify dataset-related parser options
        dataset_name = opt.dataset_mode
        dataset_option_setter = data.get_option_setter(dataset_name)
        parser = dataset_option_setter(parser, self.isTrain)

        # save and return the parser
        self.parser = parser
        return parser.parse_args() 
开发者ID:Mingtzge,项目名称:2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement,代码行数:29,代码来源:base_options.py


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