繁体   English   中英

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

[英]Keras model (RNN) predicting strange output on Floydhub

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

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

我正在使用虚拟数据集(数据有一些问题,但出于此错误报告的目的,它应该可以工作)。 如果查看数据集,您会发现它有相当数量的<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上的权重有问题。

如果您转到我的存储库并检查训练预测之间的输出,则应该很容易看到差异。

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

我的代码可以在这里看到(rnn.py)

我完全迷住了:confused:

谢谢

事实证明set()不会返回稳定的顺序。 为了解决这个问题,我在映射和标记化开始之前对单词集使用了sort()

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM