Skip to content

Instantly share code, notes, and snippets.

@irdanish11
Created October 16, 2019 08:42
Show Gist options
  • Select an option

  • Save irdanish11/bbf24746c41bdbba988bc5157aeb11ff to your computer and use it in GitHub Desktop.

Select an option

Save irdanish11/bbf24746c41bdbba988bc5157aeb11ff to your computer and use it in GitHub Desktop.
call the method to build the graph. checkpoint is created to store the best weights after every epoch. Then model is trained using 500 epochs. Then we also save the tokenizer object for further use.
model = create_model(vocabulary_size+1,seq_len)
path = './checkpoints/word_pred_Model4.h5'
checkpoint = ModelCheckpoint(path, monitor='loss', verbose=1, save_best_only=True, mode='min')
model.fit(train_inputs,train_targets,batch_size=128,epochs=500,verbose=1,callbacks=[checkpoint])
dump(tokenizer,open('tokenizer_Model4','wb'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment