Keras模型(RNN)预测Floydhub上的奇怪输出

时间:2018-07-21 14:41:05

标签: python keras

我对某些事情很困惑。据我所知,当我通过Floydhub保存模型时,模型 only 出了点问题。我什至不确定问题是否与Floydhub有关,但我不知道会发生什么,所以我现在将其归咎于他们。

我正在尝试使用Keras运行RNN,以在单词级别生成文本。

我正在使用this虚拟数据集(数据有一些问题,但是出于此错误报告的目的,它应该可以工作)。如果查看数据集,您会发现它包含相当数量的<newline>个单词。

在笔记本电脑上进行训练并保存模型时,我得到如下预测: <newline> <newline> jerry you the looks <newline> <newline> <newline> jerry you know <newline> <newline> bye the <newline> <newline> <newline> jerry flip a the the to <newline> <newline> jerry elaine you <newline> <newline> jerry elaine it <newline> <newline> jerry <newline> <newline> <newline> elaine have <newline> <newline> you jerry <newline> <newline> jerry her in <newline> <newline> <newline> i just <newline> <newline> <newline> <newline> <newline> he cometh back <newline> <newline> the you <newline> <newline> <newline> <newline> <newline> no of <newline> <newline> elaine <newline> <newline> <newline> <newline> elaine the me <newline> <newline> <newline>

但是,当我通过Floydhub进行训练时(使用完全相同的代码,只是更改路径)并保存了模型,我得到的东西是这样的: strengths dont turns hu hosting sittin avoided yayou sittin them tie sittin hu tie turns turns he biography them hereand its battery car afternoon tie into into tie sittin thanks alone turns turns brilliant minute quones shhhhh folks its car turns turns brilliant minute location decided turns turns brilliant biography them sometimes sitting thanks thanks thanks closes turns turns jer grape thursday jerrys jerrys national biography comin turns turns brilliant grape hu drawn minute paper hu probably hu mashed again turns turns jer grape office larry jerrys shop coin lie hescrazylook turns turns jer grape hu decided surprised ive meatloaf

看不到<newline>,只是词汇表中随机选择的单词-我看不到清晰的模式。当然,保存在Floydhub上的权重是有问题的。

如果您转到my repository并检查trainingprediction之间的输出,应该很容易看出区别。

在自述文件中,您将看到有关如何训练或运行预测的一些说明。同样,如果我在家用PC上进行训练和保存,一切都会正常,所以老实说,我无法弄清楚Floydhub的情况。我什至不知道问题还是Floydhub,因此,如果有人对导致此问题的原因或如何更有效地调试问题有任何想法, ,请让我知道。

可以看到我的代码here(rnn.py)

我完全感到困惑:

谢谢

1 个答案:

答案 0 :(得分:0)

结果证明,set()没有返回稳定的订单。为了解决这个问题,我在映射和标记化开始之前在单词集上使用了sort()

它在我的笔记本电脑上而不是在Floydhub上运行的原因是因为set()在同一环境中时保持稳定的顺序,尽管当然每次都在Floydhub上运行它时,都在不同的环境中运行它

相关问题