I use the Twitter_DataSet to train.
I successfully train a df_model but get errors while training a rl_model.
2019-06-19 21:55:53 Loading data ...
2 data loaded
2019-06-19 21:56:52 Data loaded.
2019-06-19 21:56:52.885374: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
300 100 100 100 2 2
df_saved\model is restored.
in RL the begining
2019-06-19 21:56:53 Now Start RL training ...
0 0
Traceback (most recent call last):
File "main.py", line 165, in <module>
rl_train(sess, mm, 0.5, 50000)
File "main.py", line 84, in rl_train
x, y, ids, seq_states, max_id = get_rl_batch(ids, seq_states, isStop, max_id, 0, 3150)
File "E:\Output\Python_output\ERD\ERD\dataUtils.py", line 187, in get_rl_batch
try:
UnboundLocalError: local variable 't_words' referenced before assignment
Here's my question, in <dataUtils.py> line 181 we try to get <t_words>.
But if we fail, there will not be a reachable <t_words>, then errors occur.
else:
try:
t_words = data[ids[i]]['text'][seq_states[i]].strip().split(" ")
except:
print(ids[i],seq_states[i])
for j in range(len(t_words)):
m_word = t_words[j]
try:
input_x[i][j] = word2vec[m_word]
except:
miss_vec = 1
input_y[i] = data_y[ids[i]]
So how can I run the code correctly?
Thank you.
I use the Twitter_DataSet to train.
I successfully train a df_model but get errors while training a rl_model.
Here's my question, in <dataUtils.py> line 181 we try to get <t_words>.
But if we fail, there will not be a reachable <t_words>, then errors occur.
So how can I run the code correctly?
Thank you.