Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Defines a small unidirectional LSTM encoder-decoder model."""
- import tensorflow as tf
- import opennmt as onmt
- def model():
- return onmt.models.SequenceToSequence(
- source_inputter=onmt.inputters.WordEmbedder(
- vocabulary_file_key="source_words_vocabulary",
- embedding_size=512),
- target_inputter=onmt.inputters.WordEmbedder(
- vocabulary_file_key="target_words_vocabulary",
- embedding_size=512),
- encoder=onmt.encoders.BidirectionalRNNEncoder(
- num_layers=4,
- num_units=1024,
- cell_class=tf.contrib.rnn.LSTMCell,
- dropout=0.3,
- residual_connections=False),
- decoder=onmt.decoders.MultiAttentionalRNNDecoder(
- num_layers=4,
- num_units=1024,
- attention_layers=[1],
- attention_mechanism_class=tf.contrib.seq2seq.LuongAttention,
- cell_class=tf.contrib.rnn.LSTMCell,
- dropout=0.3,
- residual_connections=False))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement