第5章, train.py 运行后错误提示

来源:5-8 编写从训练文件获取音符的方法

慕粉6492109

2019-08-16

老师,我执行train.py 后出现以下代码提示,
最后一句提示是: IndexError: list index out of range
请问这中情况我应该如何修改代码呢?

Traceback (most recent call last):
File “train.py”, line 83, in
train()
File “train.py”, line 16, in train
notes = get_notes()
File “/home/jinhua/mooc/MusicAI/utils.py”, line 29, in get_notes
stream = converter.parse(file)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/converter/init.py”, line 1110, in parse
forceSource=forceSource, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/converter/init.py”, line 998, in parseFile
v.parseFile(fp, number=number, format=format, forceSource=forceSource, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/converter/init.py”, line 533, in parseFile
self.parseFileNoPickle(fp, number, format, forceSource, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/converter/init.py”, line 467, in parseFileNoPickle
self.subConverter.parseFile(fp, number=number, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/converter/subConverters.py”, line 919, in parseFile
midiTranslate.midiFilePathToStream(fp, self.stream, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/midi/translate.py”, line 1952, in midiFilePathToStream
return midiFileToStream(mf, inputM21, **keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/midi/translate.py”, line 2093, in midiFileToStream
**keywords)
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/midi/translate.py”, line 1881, in midiTracksToStreams
p = s.getElementsByClass(‘Stream’)[0]
File “/home/jinhua/tensorflow/local/lib/python2.7/site-packages/music21/stream/iterator.py”, line 318, in getitem
e = fe[k]
IndexError: list index out of range

写回答

1回答

Oscar

2019-08-16

你是自己手敲的代码还是直接用我的代码?

0
2
慕粉6492109
老师,我刚用你的代买重新运行了一次 train.py文件,还是依然显示上述错误提示┭┮﹏┭┮
2019-08-16
共2条回复

基于Python玩转人工智能最火框架 TensorFlow应用实践

机器学习入门,打牢TensorFlow框架应用是关键!

2214 学习 · 688 问题

查看课程