Open akirannz opened 7 years ago
cause tf1.2.1 has a different definition of tf.nn.sampled_softmax_loss
try the following code____
def sampled_loss(labels, logits):
labels = tf.reshape(labels, [-1, 1])
return tf.nn.sampled_softmax_loss(tf.transpose(w), b, labels, logits,
config.NUM_SAMPLES, config.DEC_VOCAB)
Re solution #46 #56 . First well done... however, the solution is too cryptic for me! I have searched through the tensorflow files but cannot see where you suggest we change the code. Any chance of some elaboration? It would be appreciated.
model.py !!
be avare seq2seq in3.5 is moved to : tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq
and loss to: tf.contrib.legacy_seq2seq.sequence_loss
@samxzhang The fix was helpful. But I'm getting a deep copy error.
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 851, in embedding_attention_seq2seq
encoder_cell = copy.deepcopy(cell)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 166, in deepcopy
y = copier(memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\layers\base.py", line 793, in deepcopy
setattr(result, k, copy.deepcopy(v, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 182, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 297, in _reconstruct
state = deepcopy(state, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 243, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 218, in _deepcopy_list
y.append(deepcopy(a, memo))
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 155, in deepcopy
y = copier(x, memo)
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 223, in _deepcopy_tuple
y = [deepcopy(a, memo) for a in x]
File "C:\Users\Varsha\Anaconda3\envs\tensorflow\lib\copy.py", line 223, in
Any help is highly appreciated.
I hv trouble in running the chatbot.py, is it because of the tensorflow version? how to fix it?
python chatbot.py --mode train Data ready! Bucketing conversation number 9999 Bucketing conversation number 19999 Bucketing conversation number 9999 Bucketing conversation number 19999 Bucketing conversation number 29999 Bucketing conversation number 39999 Bucketing conversation number 49999 Bucketing conversation number 59999 Bucketing conversation number 69999 Bucketing conversation number 79999 Bucketing conversation number 89999 Bucketing conversation number 99999 Bucketing conversation number 109999 Bucketing conversation number 119999 Bucketing conversation number 129999 Bucketing conversation number 139999 Bucketing conversation number 149999 Bucketing conversation number 159999 Bucketing conversation number 169999 Bucketing conversation number 179999 Bucketing conversation number 189999 Number of samples in each bucket: [103459] Bucket scale: [1.0] Initialize new model Create placeholders Create inference Creating loss... It might take a couple of minutes depending on how many buckets you have. Traceback (most recent call last): File "chatbot.py", line 262, in
main()
File "chatbot.py", line 257, in main
train()
File "chatbot.py", line 138, in train
model.build_graph()
File "C:\Users\Alan\Documents\Udacity Deep learning\chatbot\stanford-tensorflow-tutorials-master\stanford-tensorflow-tutorials-master\assignments\chatbot\model.py", line 132, in build_graph
self._create_loss()
File "C:\Users\Alan\Documents\Udacity Deep learning\chatbot\stanford-tensorflow-tutorials-master\stanford-tensorflow-tutorials-master\assignments\chatbot\model.py", line 100, in _create_loss
softmax_loss_function=self.softmax_loss_function)
File "C:\Program Files\Anaconda3\envs\rnn2\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1221, in model_with_buckets
softmax_loss_function=softmax_loss_function))
File "C:\Program Files\Anaconda3\envs\rnn2\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1134, in sequence_loss
softmax_loss_function=softmax_loss_function))
File "C:\Program Files\Anaconda3\envs\rnn2\lib\site-packages\tensorflow\contrib\legacy_seq2seq\python\ops\seq2seq.py", line 1089, in sequence_loss_by_example
crossent = softmax_loss_function(labels=target, logits=logit)
TypeError: sampled_loss() got an unexpected keyword argument 'logits'