Skip to content

train and evaluate errors #2

@fighting41love

Description

@fighting41love
  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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions