當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。