Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error while running p8_TextRNN_train.py from a03_TextRNN #23

Closed
behnazeslami opened this issue Dec 8, 2017 · 1 comment
Closed

error while running p8_TextRNN_train.py from a03_TextRNN #23

behnazeslami opened this issue Dec 8, 2017 · 1 comment

Comments

@behnazeslami
Copy link

@brightmart
Dear Mr.brightmart,
Hi,

While I run train a03_TextRNN with google_news_wor22vec.bin and a text file with my documents + labels, I've got these errors :

error

How can I solve this issue?

cache_path: cache_vocabulary_label_pik/rnn_word_voabulary.pik file_exists: False
create vocabulary. word2vec_model_path: GoogleNews-vectors-negative300.bin
rnn_model.vocab_size: 3000001
create_voabulary_label_sorted.started.traning_data_path: train-zhihu4-only-title-all.txt
length of list_label: 146
label: 8476641588870267502 count_value: 3
label: 3738968195649774859 count_value: 3
label: -3517637179126242000 count_value: 3
label: 810067918938531886 count_value: 2
label: 7476760589625268543 count_value: 2
label: 4313812860434517324 count_value: 2
label: 1462130073299421617 count_value: 2
label: -8377411942628634656 count_value: 2
label: -7046289575185911002 count_value: 2
label: -6259864339809244567 count_value: 2
count top10: 23
create_voabulary_label_sorted.ended.len of vocabulary_label: 146
load_data.started...
load_data_multilabel_new.training_data_path: train-zhihu4-only-title-all.txt
0 x0: w18476 w4454 w1674 w6 w25 w474 w1333 w1467 w863 w6 w4430 w11 w813 w4463 w863 w6 w4430 w111
0 x1: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ys_index:
0 y: -6270130442784051389 ;ys_mulithot_list: 107
1 x1: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ys_index:
1 y: 1945786109636206690 ;ys_mulithot_list: 70
ys_index:
2 y: 7792886053889220161 ;ys_mulithot_list: 22
ys_index:
3 y: 465065448523711562 ;ys_mulithot_list: 49
number_examples: 164
load_data.ended...
start padding & transform to one hot...
trainX[0]: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
end padding & transform to one hot...

**

Traceback (most recent call last):
File "p8_TextRNN_train.py", line 184, in
tf.app.run()
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "p8_TextRNN_train.py", line 68, in main
vocab_size, FLAGS.embed_size, FLAGS.is_training)
File "/home/eslami/Downloads/all-kind-text_classification-master/a03_TextRNN/p8_TextRNN_model.py", line 33, in init
self.instantiate_weights()
File "/home/eslami/Downloads/all-kind-text_classification-master/a03_TextRNN/p8_TextRNN_model.py", line 45, in instantiate_weights
self.Embedding = tf.get_variable("Embedding",shape=[self.vocab_size, self.embed_size],initializer=self.initializer) #[vocab_size,embed_size] tf.random_uniform([self.vocab_size, self.embed_size],-1.0,1.0)
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 367, in get_variable
validate_shape=validate_shape, use_resource=use_resource)
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter
use_resource=use_resource)
File "/home/eslami/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/variable_scope.py", line 664, in _get_single_variable
name, "".join(traceback.format_list(tb))))
ValueError: Variable Embedding already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

File "/home/eslami/Downloads/all-kind-text_classification-master/a03_TextRNN/p8_TextRNN_model.py", line 45, in instantiate_weights
self.Embedding = tf.get_variable("Embedding",shape=[self.vocab_size, self.embed_size],initializer=self.initializer) #[vocab_size,embed_size] tf.random_uniform([self.vocab_size, self.embed_size],-1.0,1.0)
File "/home/eslami/Downloads/all-kind-text_classification-master/a03_TextRNN/p8_TextRNN_model.py", line 33, in init
self.instantiate_weights()
File "/home/eslami/Downloads/all-kind-text_classification-master/a03_TextRNN/p8_TextRNN_model.py", line 123, in test
textRNN=TextRNN(num_classes, learning_rate, batch_size, decay_steps, decay_rate,sequence_length,vocab_size,embed_size,is_training)

**

@brightmart
Copy link
Owner

brightmart commented Dec 12, 2017

hi. please add a variable scope where you try to get variable. thanks.
e.g.
with tf.variable_scope("embedding"):
self.Embedding = tf.get_variable(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants