Comments (18)
我同样遇到了这种错误,上网查说是restore的时候ckpt越界了,但是实际上我并没有发现越界啊。
from speech_recognition.
是我上传的模型问题?
from speech_recognition.
恩,是的,直接就报错了,运行测试代码的时候,就报这个错误
from speech_recognition.
def init_session(self):
self.savedir = self.conf.get("FILE_DATA").savedir
self.saver = tf.train.Saver(max_to_keep=1) # 生成saver
# create the session
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
self.sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
# sess = tf.Session()
# 没有模型的话,就重新初始化
self.sess.run(tf.global_variables_initializer())
ckpt = tf.train.latest_checkpoint(self.savedir)
print("ckpt:", ckpt)
self.startepo = 0
if ckpt != None:
self.saver.restore(self.sess, ckpt)
ind = ckpt.rfind("-")
self.startepo = int(ckpt[ind + 1:])
print(self.startepo)
print()
就上面这段代码中self.saver.restore(self.sess, ckpt)这句话一运行就报错:InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [36] rhs shape= [1788]
from speech_recognition.
我是运行完成了120次之后的,您是运行到100次就手动停止了吗
from speech_recognition.
我是kill进程停止的,我是用gpu训练的,和你用cpu训练有关系吗?
from speech_recognition.
没有,我也是用GPU训练的,然后训练完事直接用GPU测试的 ,测试的是用
wav_files = ['D:\音频相似度文档\声音相关的模型\Chinese-speech-to-text-master\A11_1.wav']
txt_labels = ['北京 丰台区 农民 自己 花钱 筹办 万 佛 延寿 寺 迎春 庙会 吸引 了 区内 六十 支 秧歌队 参赛']
words_size, words, word_num_map = utils.create_dict(txt_labels)
bi_rnn = BiRNN(wav_files, txt_labels, words_size, words, word_num_map)
bi_rnn.build_target_wav_file_test(wav_files, txt_labels)
用的是这个,没用上面测试的训练方法
from speech_recognition.
我第二次重新训练,训练了两步结束kill掉,也是不行,报同样的错误,上网查说是张量错误,您运行测试代码的时候是没有问题的吗
from speech_recognition.
用您这个链接中:https://pan.baidu.com/s/1skGXz8x#list/path=%2F。
提供训练好的模型,然后去测试报同样的错误。所以,您看看是不是您test中的调用应该修改什么东西啊?谢谢了
from speech_recognition.
我没改什么,那你自己训练一个新模型试试呢?
from speech_recognition.
我也是遇到一样的问题,你现在解决了么?还有你自己训练好的模型好用么? @feifaxiaoming
from speech_recognition.
@crazygirl1992 自己训练的模型也是可以的,但是你测试的时候,训练的模型是什么样的,就得用什么测试,因为作者提供的代码那里面的张量是根据训练时候的文字数量去定的,固定死了,所以你只要换成子的就报错了。
from speech_recognition.
@你使用build_target_wav_file_test报InvalidArgumentError,是因为bi_rnn.build_target_wav_file_test(wav_files, txt_labels) 这个wav_files变量有问题,它是所有训练的WAV文件,你要改成自己的测试wav,单独命名就好了
from speech_recognition.
from speech_recognition.
@soulspirit1229 你成功了吗,我也是用的CPU同样的问题啊
from speech_recognition.
Assign requires shapes of both tensors to match. lhs shape= [512,14] rhs shape= [512,1788]
[[node save/Assign_41 (defined at /home/junli/Downloads/speech_recognition-master/model.py:186) = Assign[T=DT_FLOAT, _class=["loc:@H6"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](h6/Adam_1, save/RestoreV2:41)]]
from speech_recognition.
Assign requires shapes of both tensors to match. lhs shape= [512,14] rhs shape= [512,1788]
[[node save/Assign_41 (defined at /home/junli/Downloads/speech_recognition-master/model.py:186) = Assign[T=DT_FLOAT, _class=["loc:@H6"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](h6/Adam_1, save/RestoreV2:41)]]
我也是直接用test.py训练D*字头的测试集报这个错, 感觉这个:hs shape= [512,14] rhs shape= [512,1788]应该是在恢复的时候,新测试数据中1788和原来训练集字表大小不一致,restore时出错的.还不知道怎么改.
from speech_recognition.
请问你们是怎么使用CPU运行的,我按照楼主的方法改成CPU,但CPU根本跑不起来,报错:
Traceback (most recent call last):
File "tf_speech.py", line 27, in <module>
re = X.speech_to_text('./test_voice/D4_750.wav')
File "tf_speech.py", line 22, in speech_to_text
res = bi_rnn.build_target_wav_file_test(wav_files, self.text_labels)
File "/home/zh/sda2/sg-ai/Detox_AI/tf_recong/model.py", line 214, in build_target_wav_file_test
self.init_session()
File "/home/zh/sda2/sg-ai/Detox_AI/tf_recong/model.py", line 185, in init_session
ckpt = tf.train.latest_checkpoint(self.savedir)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1805, in latest_checkpoint
ckpt = get_checkpoint_state(checkpoint_dir, latest_filename)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1061, in get_checkpoint_state
text_format.Merge(file_content, ckpt)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 536, in Merge
descriptor_pool=descriptor_pool)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 590, in MergeLines
return parser.MergeLines(lines, message)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 623, in MergeLines
self._ParseOrMerge(lines, message)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 638, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
merger(tokenizer, message, field)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 888, in _MergeScalarField
value = tokenizer.ConsumeString()
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1251, in ConsumeString
the_bytes = self.ConsumeByteString()
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1266, in ConsumeByteString
the_list = [self._ConsumeSingleByteString()]
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1291, in _ConsumeSingleByteString
result = text_encoding.CUnescape(text[1:-1])
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_encoding.py", line 103, in CUnescape
result = ''.join(_cescape_highbit_to_str[ord(c)] for c in result)
File "/home/zh/sda3/Anaconda3/envs/deep2.0.0/lib/python3.6/site-packages/google/protobuf/text_encoding.py", line 103, in <genexpr>
result = ''.join(_cescape_highbit_to_str[ord(c)] for c in result)
IndexError: list index out of range
from speech_recognition.
Related Issues (20)
- 模型测试
- 新添加语料导致输出端节点不匹配
- 训练时错误率0.8怎么回事 HOT 2
- 训练时出错,求大神帮忙 HOT 1
- 训练过的模型在哪里? HOT 4
- test.py文件报错 HOT 1
- 模型不能在CPU上运行吗? HOT 1
- 训练数据的采样率是多少
- 完全就是假效果,靠作弊训练的结果,大家不要信他的 HOT 2
- 我的结果如下,怎么回事啊? HOT 7
- 语音预处理问题
- 代码的函数是不是不全
- 结果也太假了
- Excellent Codes,非常好的代码,感谢!
- 非常好且适合学习的代码, 就是不知道怎么继续训练
- 大佬您好, 如何增加素材继续训练呢 HOT 1
- 训练数据时错误率为0
- 能不能出一个详细的训练调用教程
- 高精度中文语音转写网站(免费)
- Label file is not avaliable and there is something wrong in do_get_wavs_lables() func while the train data it is obtained in https://www.openslr.org test-noise.tgz
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speech_recognition.