跑这个教程的代码 如何用Python和深度神经网络寻找近似图片?,使用机器学习框架TuriCreate时出现了一些错误,这里记录一下。
1、
导入库 import turicreate as tc 的时候出现报错:
ImportError: libblas.so.3: cannot open shared object file: No such file or directory
这是缺少依赖项,解决办法:
Import Error · Issue #191 · apple/turicreate
turicreate/INSTALL_ISSUES.md at master · apple/turicreate
libblas and liblapack issues and speed, with SciPy and Ubuntu — Daniel Nouri's Blog
2、
安装turicreate(pip install -U turicreate)时会顺便安装cpu 版本的mxnet,在执行如下代码时:
model = tc.image_similarity.create(data)
第一次使用会下载两个文件,一直下不动,卡在如下位置:
Downloading https://docs-assets.developer.apple.com/turicreate/models/resnet-50-symbol.json
Download completed: /var/tmp/model_cache/resnet-50-symbol.json
Downloading https://docs-assets.developer.apple.com/turicreate/models/resnet-50-0000.params
于是自己手动下载这两个文件,放到 /var/tmp/model_cache/ 目录下,也可以使用如下命令查看应该放到哪里。参考
tc.config.get_runtime_config()['TURI_CACHE_FILE_LOCATIONS']
3、
我使用的是GPU,执行上面那句又报错:
ERROR: Incomplete installation for leveraging GPUs for computations.
Please make sure you have CUDA installed and run the following line in
your terminal and try again:
pip uninstall -y mxnet && pip install mxnet-cu100==1.4.0
Adjust 'cu100' depending on your CUDA version ('cu90' and 'cu80' are also available).
You can also disable GPU usage altogether by invoking turicreate.config.set_num_gpus(0)
根据提示先卸载,然后安装GPU版本的mxnet。