seq2seq模型笔记

记一下一些坑

  1. tensorflow的版本很重要,强烈推荐tf-gpu 1.5或1.6
  2. tf新版本更新了beam search功能,不需要自己再实现了,infer用tf.contrib.seq2seq.BeamSearchDecoder即可,相比Greedy helper,只需要把output矩阵从原来的[batch_size, decoder_target_length]改成[batch_size, decoder_target_length, beam_search_size]来储存多个输出。
  3. learning rate太大,很容易出现loss=inf的情况,这种情况会导致seq2seq预测出的全部为重复的单个字
  4. 字典一定要截取,从10W截取到2W,一个epoch从40min+降低到18min

猜你喜欢

转载自blog.csdn.net/thormas1996/article/details/81093457