Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Initialize needed variables
# For saving demo resources, use batch size 1 and step 1.
BATCH_SIZE = 1
NUM_TIMESTEPS = 1
MAX_WORD_LEN = 50
# File Paths
vocab_file = "language_model/data/vocab-2016-09-10.txt"
save_dir = "language_model/output"
pbtxt = "language_model/data/graph-2016-09-10.pbtxt"
ckpt = "language_model/data/ckpt-*"
#Vocabulary containing character-level information.
vocab = data_utils.CharsVocabulary(vocab_file, MAX_WORD_LEN)
targets = np.zeros([BATCH_SIZE, NUM_TIMESTEPS], np.int32)
weights = np.ones([BATCH_SIZE, NUM_TIMESTEPS], np.float32)
inputs = np.zeros([BATCH_SIZE, NUM_TIMESTEPS], np.int32)
char_ids_inputs = np.zeros([BATCH_SIZE, NUM_TIMESTEPS, vocab.max_word_length], np.int32)
# Recovers the model from protobuf
sess, t = LoadModel(pbtxt, ckpt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.