[补充]我后期用ubuntu系统运行,就没有出现下面这些问题,开始用的torch1.7,python3.6跑几个实验还会出现中断的问题,我换成torch1.0,python3.6就没有这些问题了!(路径还是用全路径比较好,同时将ProcessedData放在C3-Framework外面,因为他每次实验都会将C3-Framework文件夹中的东西都复制进去。)
github地址为:https://github.com/gjy3035/C-3-Framework
1.python.exe无法找到入口
出现这个错误,找到这个C.pyd文件删除就好了
2.raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.forma
解决方案:
是把含有多线程操作的部分放在 if __name__ == '__main__'
的范围内,在我这里即
if __name__ == '__main__':
for epoch in range(3):
for step, (batch_x, batch_y) in enumerate(loader):
# 假设这里就是你训练的地方...
每次出错都会报很多错误,我们找到相应的其中一个错误,把这个错误解决这个问题就解决了!
3.AttributeError: 'EasyDict' object has no attribute 'iteritems
解决方案:
you’re using Python 3.
You just need to replace „a.iteritems()“ with „a.items()“ (Check out this link: python - Error: " 'dict' object has no attribute 'iteritems' " - Stack Overflow).
You might have to change 1-2 other small things in the code if you’re using Python 3 (nothing too complicated though, but I guess you’ll get another 1-2 or more exceptions that you’d need to fix before it works with Python 3).
Otherwise it might be easier to use Python 2 if you just want to run the model.
训练是config.py用的他的配置文件的话会出现 AttributeError: 'EasyDict' object has no attribute 'RESUME'这个错误
这是因为config.py没有RESUME这个参数(这个参数管着是否接着上一次的训练结果继续训练)
4.TensorFlow报AttributeError: module tensorflow has no attribute io
将 with tf.io.gfile.GFile(path, 'r') as fid:
改为with tf.gfile.GFile(path, 'r') as fid:
但是又出现了新的错误:
AttributeError: module 'tensorflow' has no attribute 'gfile'
解决方法:直接pip install io(升级tensorflow到2.x版本)
5.TabError: Inconsistent use of tabs and spaces in indentation
这个错误的解决通过将代码复制到sublime text3中,定位到出问题的行,然后将没有问题的行的代码的空格复制到有问题哪里,就解决了!