深度学习碰见的报错信息汇总
1 报错:AttributeError: module ‘torchtext.data’ has no attribute ‘Field’
原文代码如下
 | 
更改成如下引用即可
 | 
2 报错:TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
问题描述
如果想把CUDA tensor格式的数据改成numpy时,需要先将其转换成cpu float-tensor随后再转到numpy格式。 numpy不能读取CUDA tensor 需要将它转化为 CPU tensor
 | 
3 报错在导入torch的时候报错
报错内容:TqdmWarning: IProgress not found. Please update jupyter and ipywidgets.
解决办法:
- 卸载jupyter:pip uninstall jupyter
 - 卸载ipywidgets:pip uninstall ipywidgets
 - 安装jupyter:pip install jupyter
 - 安装ipywidgets:pip install ipywidgets
 - 关联:jupyter nbextension enable –py widgetsnbextension
 
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 The path of Learning!