hit-computer / char-rnn-tf Goto Github PK
View Code? Open in Web Editor NEWImplement character-level language models for text generation based-on LSTM, in Python/TensorFlow
Implement character-level language models for text generation based-on LSTM, in Python/TensorFlow
你好呀,我也在搞中文文本生成,不过刚刚才学习,资料太少了,好不容易才看见你的这个。
我想问下我运行程序的时候会出现下面的错误:
2017-07-01 22:39:07.199671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0)
WARNING:tensorflow:<tensorflow.python.ops.rnn_cell_impl.BasicLSTMCell object at 0x7ff6cc713350>: Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True.
Training Epoch: 1 ...
Traceback (most recent call last):
File "train.py", line 98, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train.py", line 89, in main
train_perplexity = run_epoch(session, m, train_data, m.train_op)
File "train.py", line 66, in run_epoch
if step and step % (epoch_size // 10) == 0:
ZeroDivisionError: integer division or modulo by zero
这个是为什么呢?咋会出现这个错误啊?
raw_data = np.array(raw_data, dtype=np.int32)
data_len = len(raw_data)
batch_len = data_len // batch_size #batch_len=总batch数
data = np.zeros([batch_size, batch_len], dtype=np.int32) #整个数据拆分成一个batch_size*batch_len的二维矩阵
for i in range(batch_size):
data[i] = raw_data[batch_len * i:batch_len * (i + 1)]#data的shape是(batch_size, batch_len),每一行是连贯的一段,一次可输入多个段
#这里看不是很明白 data[i]是走batch_size也就是从batch的0位走向末位,比如i=0的时候,data[0]=源数据中的根据batch_len取一行放入,这个看不是很明白
感觉这里不是应该是batch方向连续的吗?为什么是batchlen方向连续呢??
需要安装tensorflow?再运行这个程序?还是安装char-rnn?
我输入命令是:python train.py all.txt(all.txt数据大小是50.7MB)
现在输出的结果是:
。。。。。。。
Using a concatenated state is slower and will soon be deprecated. Use state_is_tuple=True.
Training Epoch: 1 ...
一直显示在Training Epoch :1....
是显示在训练过程么?
还要很久么?
请教一下 谢谢!
您好,请问为什么每次run_echo()的时候都要想graph里面塞一个no_op()的block呢?我没有太理解这个操作的理由。
我尝试将项目部署为在线服务,每次添加no_op()会导致graph越来越大,返回越来越慢。希望能解答,谢谢!
2017-08-28 18:15:11,067 INFO - Traceback (most recent call last):
2017-08-28 18:15:11,067 INFO - File "train.py", line 14, in
2017-08-28 18:15:11,067 INFO - file = sys.argv[1]
2017-08-28 18:15:11,067 INFO - IndexError: list index out of range
这是我在floydhub上测试的结果
我尝试着修改了file的路径,但是不理想,不知道问题出在了哪里?
请问您有头绪么?
谢谢
您好,我訓練完成後,可以使用單個字作為 seed,但不知如何傳一段中文字串作為 seed,希望可以指點一下迷津,謝謝~
如题
将一些过程中的特殊情况列出来方便有类似问题的伙伴:
tf.nn.seq2seq
模块,把 tf.nn.seq2seq
改成 tf.contrib.legacy_seq2seq
即可
train.py
和 generate.py
都需要更改你好!首先非常感谢你在百忙之中看我的issue,训练语料(中文)太大,无法一次性加载,我希望能够分批增量训练,就是在原来模型基础上再次使用新文章进行补充训练,需要怎么改好那?我多次尝试好像失败了。谢谢!
读了您这篇文章,感觉非常好。不知是否会开源 ‘基于Attention的受关键词控制的文本生成模型’ ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.