leido / char-rnn-cn Goto Github PK
View Code? Open in Web Editor NEW基于char-rnn和tensorflow生成周杰伦歌词
基于char-rnn和tensorflow生成周杰伦歌词
刚才运行了下,报错了:
--Training--
Vocabulary Size: 2636
Traceback (most recent call last):
File "gen_lyrics.py", line 196, in <module>
main(infer)
File "gen_lyrics.py", line 184, in main
run_fn(data, model, args)
File "gen_lyrics.py", line 124, in train
sess.run(tf.global_variables_initializer())
AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'
你的城魂 我想就这样牵着你的手不放开 爱能不能够永远单纯没有悲哀 可是你不在里 合:我们乘着阳光 你的眼中只有我 我不想输 不知不见 你就是不该 我不像已在事人已经不是我 我不想拆穿你 不过的温柔 双篱布 那感门 只有一种每一页 我也离去 我想是你不我再想 我不 我不 我不要再想 我不 我不 我不 我不 我不要再想 我不 我不 我不 我不 我不要再想 我不 我不 我不 我不 我不要再想 我不 我不 我不 我不 我不要再想
warm phrase还是用的“你要离开我知道很简单”
训练的时候,使用的是红楼梦充当字典,并没有使用周杰伦的歌词,所以模型并没有周杰伦的歌词表达习惯。
生成的时候,把字典从红楼梦换到了周杰伦,模型没有做任何变化。如果周杰伦歌词的字要比红楼梦少,模型预测出来的词id超过了字典。那不会报越界的异常吗
你的gen_lyrics.py 运行会报错 提示tensorflow:<tensorflow.python.ops.rnn_cell_BasicLSTMCell object at ox7f5d028cae10> 我是python 3.5 难道环境有问题?
ValueError: Cannot feed value of shape (1, 1) for Tensor 'inputs/Placeholder:0', which has shape '(32, 20)'
求更新,1.0的api有些用不了了
--Training--
Vocabulary Size: 2636
Traceback (most recent call last):
File "gen_lyrics.py", line 235, in
main(infer)
File "gen_lyrics.py", line 216, in main
data = DataGenerator('JayLyrics.txt', args)
File "gen_lyrics.py", line 51, in init
self.save_metadata(args.metadata)
File "gen_lyrics.py", line 64, in save_metadata
f.write('{}\t{}\n'.format(i, c))
UnicodeEncodeError: 'cp950' codec can't encode character '\u3007' in position 3: illegal multibyte sequence
你好,我在本机上跑了你的程序,但是出了问题,提示如下:ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x10d307be0> with a different variable scope than its first use. First use of cell was with scope 'rnn/multi_rnn_cell/cell_0/basic_lstm_cell', this attempt is with scope 'rnn/multi_rnn_cell/cell_1/basic_lstm_cell'. Please create a new instance of the cell if you would like it to use a different set of weights. If before you were using: MultiRNNCell([BasicLSTMCell(...)] * num_layers), change to: MultiRNNCell([BasicLSTMCell(...) for _ in range(num_layers)]). If before you were using the same cell instance as both the forward and reverse cell of a bidirectional RNN, simply create two instances (one for forward, one for reverse). In May 2017, we will start transitioning this cell's behavior to use existing stored weights, if any, when it is called with scope=None (which can lead to silent model degradation, so this error will remain until then.)
请问您知道是哪里出了毛病吗?
电脑环境:Macos,python3.6,tensorflow1.1.0
it occurs that InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [100,2636] rhs shape= [100,4553]
[[Node: save/Assign_15 = Assign[T=DT_FLOAT, _class=["loc:@rnnlm/softmax_w"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](rnnlm/softmax_w/Adam, save/RestoreV2_15)]]
when I run generate_text.py.
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.