Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
229 views
in Technique[技术] by (71.8m points)

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

I'm trying to run Retrieval-eval.py, but I am encountering the following error:

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

I'm using get_sim_score() method to compute similarity score from another directory while going through that method it goes to argparser.py here i got this error showed above. This is my argparser.py here in class NeonArgparser() im encountering that error. Can anyone help me with this error?

**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()

Here is the exception trace, Please have a look.

    (ronin) pratyusha@pratyusha-Q304UAK:~/Projects/ronin$ python Retrieval-Eval.py
No handlers could be found for logger "gensim.models.doc2vec"
<IPython.core.display.HTML object>
Can you suggest a spa for us?
Are transport facilities available here?
Traceback (most recent call last):
  File "Retrieval-Eval.py", line 484, in <module>
    e = evaluate(dialogue, dtype="str", concept_weight=1.0, task_weight=0)
  File "Retrieval-Eval.py", line 248, in evaluate
    retrieval2 = get_skipsim_matches(selected=questions, dtype="str", conceptW=concept_weight, taskW=task_weight)  #HERE !!!!!!!!!!!!!
  File "Retrieval-Eval.py", line 446, in get_skipsim_matches
    conceptDictionary = get_skipsim_concept_dictionary(selected[1:], dtype)   
  File "Retrieval-Eval.py", line 464, in get_skipsim_concept_dictionary
    scores = get_list_skipsim_scores(selected, dialogue, dtype)   
  File "Retrieval-Eval.py", line 430, in get_list_skipsim_scores
    score = st.get_sim_score(q1, q2)    
  File "/home/pratyusha/Desktop/neon/examples/skipthought/inference.py", line 132, in get_sim_score
    a = self.get_sentence_vec(text1)
  File "/home/pratyusha/Desktop/neon/examples/skipthought/inference.py", line 50, in get_sentence_vec
    parser = NeonArgparser(__doc__)
  File "/home/pratyusha/.virtualenvs/ronin/local/lib/python2.7/site-packages/neon/util/argparser.py", line 80, in __init__
    super(NeonArgparser, self).__init__(*args, **kwargs)
TypeError: __init__() got multiple values for keyword argument 'add_config_file_help'

Thank You `

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is mainly due to a bug in latest version of ConfigArgParse. For now to get you unblocked please install some version other than latest by running this command:

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

If you are running from within a shell you may want to escape some chars:

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

and now you should be able to run the example: `

$ 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%`

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...