TypeError:__ init __()得到了关键字参数" add_config_file_help'的多个值。

时间:2018-02-17 04:33:13

标签: django python-2.7

我试图运行Retrieval-eval.py,但我遇到以下错误:

data work.ldl;

set hw4.ldldat;

delta_LDL = LDL_post - LDL_pre;

if LDL_pre = . then group = "";

    else if LDL_pre<100 then group="Pre less than 100";

    else if LDL_pre>100 then group="Pre greater than 100";

if LDL_post =. then group ="";

    else if LDL_post<100 then group="Post less than 100";

    else if LDL_post>100 then group="Post greater than 100";

我使用get_sim_score()方法来计算来自另一个目录的相似度得分,同时通过该方法转到argparser.py这里我得到了上面显示的这个错误。这是我在类NeonArgparser()中遇到该错误的argparser.py。任何人都可以帮我解决这个错误吗?

 TypeError: __init__() got multiple values for keyword argument 'add_config_file_help'                                     

这是异常追踪,请看一下。

**class NeonArgparser(configargparse.ArgumentParser):**
    """
    Setup the command line arg parser and parse the
    arguments in sys.arg (or from configuration file).  Use the parsed
    options to configure the logging module.*emphasized text*

    Arguments:
        desc (String) : Docstring from the calling function. This will be used
                        for the description of the command receiving the
                        arguments.
    """
    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()

谢谢你

1 个答案:

答案 0 :(得分:2)

这主要是由于 ConfigArgParse 的最新版本中的错误。 现在为了让您解锁,请运行此命令安装除最新版本之外的其他版本:

pip install --no-cache-dir ConfigArgParse>=0.10.0,<0.13.0

如果你在shell中运行,你可能想要逃避一些字符:

pip install --no-cache-dir ConfigArgParse\>\=0.10.0,\<0.13.0

现在你应该可以运行这个例子了: `

$ python examples/mnist_mlp.py -b cpu
Epoch 0   [Train |████████████████████|  469/469  batches, 0.27 cost, 1.39s]
Epoch 1   [Train |████████████████████|  469/469  batches, 0.20 cost, 1.43s]
Epoch 2   [Train |████████████████████|  469/469  batches, 0.18 cost, 1.44s]
Epoch 3   [Train |████████████████████|  468/468  batches, 0.14 cost, 1.44s]
Epoch 4   [Train |████████████████████|  468/468  batches, 0.12 cost, 1.45s]
Epoch 5   [Train |████████████████████|  468/468  batches, 0.11 cost, 1.45s]
Epoch 6   [Train |████████████████████|  468/468  batches, 0.11 cost, 1.44s]
Epoch 7   [Train |████████████████████|  468/468  batches, 0.09 cost, 1.45s]
Epoch 8   [Train |████████████████████|  468/468  batches, 0.09 cost, 1.50s]
Epoch 9   [Train |████████████████████|  468/468  batches, 0.08 cost, 1.44s]
2018-02-27 18:49:54,287 - neon - DISPLAY - Misclassification error = 2.5%`