chiphuyen / stanford-tensorflow-tutorials

This repository contains code examples for the Stanford's course: TensorFlow for Deep Learning Research.
http://cs20.stanford.edu
MIT License
10.32k stars 4.32k forks source link

AttributeError: module 'config' has no attribute 'DEC_VOCAB' #63

Open yinseng2001 opened 7 years ago

yinseng2001 commented 7 years ago

File "/Users/apple/tensorflow/stanford-tensorflow-tutorials/assignments/chatbot/model.py", line 51, in _inference if config.NUM_SAMPLES > 0 and config.NUM_SAMPLES < config.DEC_VOCAB: AttributeError: module 'config' has no attribute 'AttributeError: module 'config' has no attribute 'DEC_VOCAB''

I cannot file DEC_VOCAB and NUM_SAMPLES in config file, which number should i use for both value?

kiranvarghesev commented 6 years ago

Check Tensorflow version: sampled_loss function. try the code below

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)

MartinAbilev commented 6 years ago

if i rememberer correctly. this values is added automatic after you run data.py. because data.py create vocabs and add length to config file every time you run data.py new line is added at the end of config file

MartinAbilev commented 6 years ago

it looks like

NUM_SAMPLES = 512
ENC_VOCAB = 24513
DEC_VOCAB = 24674