1、ModuleNotFoundError: No module named ‘tornado.platform.auto’
----> 3 from tornado.platform.auto import set_close_exec
解决:我的tornado版本为6.1,在官网https://www.tornadoweb.org/en/stable/releases了解到6.1版本中的set_close_exec已被移除,所以要对tornado版本降级。根据官网介绍,选择了tornado6.0解决了该问题。
2、AttributeError: ‘str’ object has no attribute ‘decode’
D:\anoconda\envs\simair\lib\site-packages\keras\models.py in load_model(filepath, custom_objects, compile)
237 if model_config is None:
238 raise ValueError('No model found in config file.')
--> 239 model_config = json.loads(model_config.decode('utf-8'))
240 model = model_from_config(model_config, custom_objects=custom_objects)
241
AttributeError: 'str' object has no attribute 'decode'
解决:
我的h5py版本为3.2.0,更新为2.10.0
pip install h5py=2.10.0
3、TypeError: unsupported operand type(s) for *: ‘ZMQIOLoop’ and ‘float’
此错误与tornado版本有关,查到应该用tornado==4.5.3,所以pip install tornado==4.5.3
安装之后发现jupyter notebook会闪退,原因是jupyter notebook和tornado版本对应,如下图:
所以接着重新安装notebook,这里我选择了5.7.8,pip install notebook==5.7.8,安装完之后快捷方式jupyter notebook还是闪退,不过可以在prompt中得对应环境下输入 jupyter notebook来打开,代码可以运行了。
4、UnknownError (see above for traceback): Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
在命令行显示器下显示如下错误:
Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED
##方法一
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)
##方法二
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=args.gpu_memory_fraction,allow_growth=True)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
##方法三:
把config.gpu_options.per_process_gpu_memory_fraction = 1
改成config.gpu_options.per_process_gpu_memory_fraction = 0.4