Code Monkey home page Code Monkey logo

code-to-comment's People

Contributors

thaije avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

code-to-comment's Issues

list out of range error

Thanks for thaije sharing the codes online. I learned a lot from this.

Here is my question.

  1. I trained a model by function train() first.

  2. Then call function evaluate() to translate sentences in 10pt.random.code
    I got the following error.
    File "/Users/yy/PycharmProjects/code_to_comment/seq2seq/translate.py", line 434, in <module> tf.app.run() File "/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv)) File "/Users/yy/PycharmProjects/code_to_comment/seq2seq/translate.py", line 429, in main evaluate() File "/Users/yy/PycharmProjects/code_to_comment/seq2seq/translate.py", line 347, in evaluate translate_file() File "/Users/yy/PycharmProjects/code_to_comment/seq2seq/translate.py", line 198, in translate_file translated_file.write(" ".join([tf.compat.as_str(rev_en_vocab[output]) for output in outputs]) + "\n") IndexError: list index out of range
    rev_en_vocab is a list that generated from the file "vocab100000.code", which only contains 21298 elements. However the element in outputs (len(output)=50) is 80000+. which leads to the "list out of range error".

  3. Is there something wrong with the vocab100000.code ?

  4. Or is there something wrong with the output variable ?

Anyone can help me please?
Thanks!

train and evaluate errors

  1. We can successfully run the train() and evaluate() seperately.
  2. We first train and save each model. Then, evaluate the performance of the model after the training.
    There is an error:

( Mac os 10.11, python 2.7, tensorflow 0.11.0)
`Preparing data in ./data/django/
Creating 2 layers of 512 units.
Reading model parameters from ./train/translate.ckpt-40
Reading development and training data (limit: 0).
Traceback (most recent call last):
File "translate.py", line 443, in
tf.app.run()
File "/anaconda/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "translate.py", line 440, in main
train()
File "translate.py", line 290, in train
evaluate()
File "translate.py", line 352, in evaluate
translate_file()
File "translate.py", line 149, in translate_file
model = create_model(sess, False)
File "translate.py", line 225, in create_model
forward_only=forward_only)
File "/Users/yy/PycharmProjects/test_code2comment/seq2seq/seq2seq_model.py", line 89, in init
w = tf.get_variable("proj_w", [size, self.target_vocab_size])
File "/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 339, in get_variable
collections=collections)
File "/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 262, in get_variable
collections=collections, caching_device=caching_device)
File "/anaconda/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 118, in get_variable
name, "".join(traceback.format_list(tb))))
ValueError: Variable proj_w already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

File "/Users/yy/PycharmProjects/test_code2comment/seq2seq/seq2seq_model.py", line 89, in init
w = tf.get_variable("proj_w", [size, self.target_vocab_size])
File "translate.py", line 225, in create_model
forward_only=forward_only)
File "translate.py", line 248, in train
model = create_model(sess, False)`

Anyone know how to solve the problem?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.