- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
当我最初在莎士比亚语料库上运行 2 个 LSTM 网络(每个 512 个单元)时,经过 2 个 epoch 的训练(其中每个 epoch = 数据集的一个周期),我得到了相当不错的输出。这是:
我最好的病房他是你从他那个时代起就让贵族感到佩服的人吗?
维根公爵:所以,这个人,更重要的是,舌头是一个整体,你将与每一堵墙融为一体。
霍尔:嘿,您的大厅,请对我唯一的男人先生说好话,两人用您和我的永远的方式作为堡垒,将折痕。
哈莱特:
它仍在学习,损失为 1.73,并且损失图表并未趋于平稳。然而,在所有后续运行 (10) 中,它一直无法取得尽可能好的结果 - 例如,在 6 个 epoch 之后,在我随后的最佳运行中,它的损失为 2.43,并且趋于平稳 -这是输出:
修士?我的脚趾或内鲁怎么样 o inain me c ahes oisteese 和 th thet ot spr h 坐在摩西·勒穆德的耶顿·德·胡埃斯特里德面前,我们将增加脚趾练习和家庭回顾哈德·蒂克·特·奥福雷爵士hhe serined o chane the ertrs aine thele aelt To tee g te 哦,所以,我们一定会住在他那里,但在 jnt hu作为 ehmug te 到 fare t ceTo tha mhn hi did r t ter oe hirrat ft thr ionyoee wh eoo that e cade tientta Totike a r hee ta the he
这与 4、5、6 epoch 后的输出类似。最常见的是,在初始运行之后的运行中,网络会在损失 2.70 后趋于平稳。
This is the graph of the loss 我还发布了代码:
from __future__ import absolute_import, division, print_function
import os
import numpy as np
import tflearn
from tflearn.data_utils import *
from tflearn.layers.estimator import regression
inputs, targets, char_dict = \
textfile_to_semi_redundant_sequences("shakespeare_input.txt", seq_maxlen=20) #helper - vectorises text
LSTM = tflearn.input_data([None, 20, len(char_dict)])
LSTM = tflearn.lstm(LSTM, 512, return_seq=True, restore=True, dropout = 0.5)
LSTM = tflearn.lstm(LSTM, 512, restore=True, dropout = 0.5)
LSTM = tflearn.fully_connected(LSTM, len(char_dict), activation='softmax')
LSTM = tflearn.regression(LSTM, optimizer= 'adam', loss='categorical_crossentropy',
learning_rate=0.001)
LSTMmodel = tflearn.SequenceGenerator(LSTM, dictionary=char_dict,
seq_maxlen=20,
clip_gradients=5.0, tensorboard_verbose=0,tensorboard_dir='pathfile/logs')
#LSTMmodel.load('/pathfile/LSTMmodel.tfl')
for i in range(10):
print("-- TESTING...")
starting = random_sequence_from_textfile("shakespeare_input.txt", 20)
output_path = 'pathfile/epoch_' + str(i) + '_output.txt'
generated_output = LSTMmodel.generate(500, temperature=1.0, seq_seed=starting)
text_file = open(output_path, "w") #save the outputs to a text file - allows us to view progress of model
text_file.write("With temperature 1.0: \n \n \n") #two different temperatures - higher temp = more novel
text_file.write(generated_output)
generated_output = LSTMmodel.generate(500, temperature=0.5, seq_seed=starting) #lower temp = more accurate to original text
text_file.write("\n \n \n With temperature 0.5: \n \n \n")
text_file.write(generated_output)
text_file.close()
print("-- TRAINING...")
LSTMmodel.fit(inputs, targets, batch_size=200, n_epoch=1, run_id='Shakespeare_Generator',shuffle = True)
print("-- SAVING MODEL...")
if (i%2==0):
LSTMmodel.save("pathfile/LSTMmodel.tfl")
else:
LSTMmodel.save("pathfile//LSTMmodel2.tfl")
print("-- EPOCH " + str(i+1) +" COMPLETE...")
由于我在一台具有 4GB RAM 的旧双核 i3 上运行此程序,因此网络需要 6 小时 45 分钟才能完成一个 epoch。当然,至少需要两个时期才能看到结果。不幸的是,我无法继续调整代码并运行和重新运行。我还受到计算机内存的限制,因为 4 个内存中的 1GB 分配给 Ubuntu,另外 3 个分配给 Windows。因此,我只能训练一个小型网络。
如果有人可以提供预训练网络的链接,我将不胜感激
最佳答案
我没有这个模型的答案,但是您是否尝试过从莎士比亚生成 LSTM 的现有示例开始,例如这个?
https://github.com/sherjilozair/char-rnn-tensorflow
训练起来应该会更快一些,如果您从一个工作示例开始,那么调试出问题的地方可能会更容易。
关于python - 为什么网络学习效果不高(Tensorflow - 用于文本生成的 LSTM)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39551564/
我正在寻找一种方法来创建根据价格选择我的产品的过滤器(选择下拉菜单)。 我知道这样的查询是完全可能的: SELECT * FROM products ORDER BY price ASC SELECT
函数参数中或显示尺寸时(高度,宽度)的顺序是否有约定? 最佳答案 我不知道大量的语言,但我使用过的语言(宽度,高度)。它更适合沿着 (x, y) 坐标线。 关于language-agnostic -
在我的表单中,我让用户输入房间的长度高度和宽度以获得 m2、m3 和瓦特的计算值。但是用户也应该能够直接输入 height 和 m2 来获取值。我尝试了很多语法,但 if else 不能正常工作。我知
我在 Elasticsearch 中创建了一个索引,看起来像 {"amazingdocs":{"aliases":{},"mappings":{"properties":{"Adj Close":{"
我有以下功能,我需要清除数据库中的所有图片列并移动到文件系统。当我一次性完成这一切时,内存太多并且会崩溃。我切换到递归函数并执行 20 次写入和批量操作。 我需要为大约 6 个表执行此操作。我的 Re
我正在编写一个函数来计算 PI 的值,并将其作为 double 值返回。到目前为止,一切都很好。但是一旦函数到达小数点后14位,它就不能再保存了。我假设这是因为 double 有限。我应该怎么做才能继
2020年是中国CDN行业从98年诞生到今天快速发展的第二十四年,相关数据显示,全国感知网速持续上扬,达到了3.29兆/秒,标志着在宽带中国的政策指导下,中国的网速水平正在大步赶上世界发达国家的水平
在 aerospike 集合中,我们有四个 bin userId、adId、timestamp、eventype,主键是 userId:timestamp。在 userId 上创建二级索引以获取特定用
$('#container').highcharts('Map', { title : { text : 'Highmaps basic demo'
有没有办法显示自定义宽度/高度的YouTube视频? 最佳答案 在YouTube网站上的this link中: You can resize the player by editing the obj
我使用 Highcharts ,我想在 Highcharts 状态下悬停时制作动态不同的颜色。 正如你可以看到不同的颜色,这就是我做的 var usMapChart , data = [] ; va
在所有节点上运行 tpstats 后。我看到很多节点都有大量的 ALL TIME BLOCKED NTR。我们有一个 4 节点集群,NTR ALL TIME BLOCKED 的值为: 节点 1:239
我发现 APC 上存在大量碎片 (>80%),但实际上性能似乎相当不错。我有 read another post这建议在 wordpress/w3tc 中禁用对象缓存,但我想知道减少碎片是否比首先缓存
对于我的脚本类(class),我们必须制作更高/更低的游戏。到目前为止,这是我的代码: import random seedVal = int(input("What seed should be u
我发现 APC 上存在大量碎片 (>80%),但实际上性能似乎相当不错。我有 read another post这建议在 wordpress/w3tc 中禁用对象缓存,但我想知道减少碎片是否比首先缓存
对于我的脚本类(class),我们必须制作更高/更低的游戏。到目前为止,这是我的代码: import random seedVal = int(input("What seed should be u
我已经 seen >2 字节的 unicode 代码点,如 U+10000 可以成对编写,如 \uD800\uDC00。它们似乎以半字节 d 开头,但我只注意到了这一点。 这个 split Actio
有人可以帮我理解为什么我的饼图百分比计算不正确吗?看截图: 根据我的计算,如 RHS 上所示,支出百分比应为 24.73%。传递给 Highcharts 的值如下:- 花费:204827099.36-
我阅读了有关该问题的所有答案,但我还没有找到任何解决方案。 我有一个应用程序,由我的 api 服务器提供。 Wildfly 8.1 和 Mysql 5.6。当查看时间到来时(Wildfly 服务器连接
我正在用选定的项目创建圆形导航。当用户单击任何项目时,它将移动到定义的特定点。一切都很好,除了当你继续点击项目时,当动画表现不同并且项目在 360 度圆中移动并且它被重置直到你重复场景时,我希望它
我是一名优秀的程序员,十分优秀!