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

Adapting to the API Changes in latest release 0.12.1! #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions chatbot/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,17 @@ def sampledSoftmax(labels, inputs):

# Creation of the rnn cell
def create_rnn_cell():
encoDecoCell = tf.contrib.rnn.BasicLSTMCell( # Or GRUCell, LSTMCell(args.hiddenSize)
encoDecoCell = tf.nn.rnn_cell.BasicLSTMCell( # Or GRUCell, LSTMCell(args.hiddenSize)
self.args.hiddenSize,
)
if not self.args.test: # TODO: Should use a placeholder instead
encoDecoCell = tf.contrib.rnn.DropoutWrapper(
encoDecoCell = tf.nn.rnn_cell.DropoutWrapper(
encoDecoCell,
input_keep_prob=1.0,
output_keep_prob=self.args.dropout
)
return encoDecoCell
encoDecoCell = tf.contrib.rnn.MultiRNNCell(
encoDecoCell = tf.nn.rnn_cell.MultiRNNCell(
[create_rnn_cell() for _ in range(self.args.numLayers)],
)

Expand All @@ -168,7 +168,7 @@ def create_rnn_cell():
# Define the network
# Here we use an embedding model, it takes integer as input and convert them into word vector for
# better word representation
decoderOutputs, states = tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq(
decoderOutputs, states = tf.nn.seq2seq.embedding_rnn_seq2seq(
self.encoderInputs, # List<[batch=?, inputDim=1]>, list of size args.maxLength
self.decoderInputs, # For training, we force the correct output (feed_previous=False)
encoDecoCell,
Expand All @@ -194,7 +194,7 @@ def create_rnn_cell():
# For training only
else:
# Finally, we define the loss function
self.lossFct = tf.contrib.legacy_seq2seq.sequence_loss(
self.lossFct = tf.nn.seq2seq.sequence_loss(
decoderOutputs,
self.decoderTargets,
self.decoderWeights,
Expand Down