IProgress not found. Please update jupyter and ipywidgets.Transformers 导入预训练模型报错

项目场景:

使用Huggingface的Transformers第一次导入预训练模型的时候会报这个错。


问题描述:

第一次运行demo的时候需要下载预训练模型,接着就会卡在这一步。网上看了一些,说什么卸载jupyter重装、或者重新安装ipywidgets的,都不管用。

ImportError:IProgress not found. Please update jupyter and ipywidgets.

原因分析:

本质上却少了相关的包,直接pip install IProgress或者是conda install IProgress并不能解决问题,其实这个报错后面有提示,去看官方文档就可以解决这个问题:Installation — Jupyter Widgets 7.6.5 documentation


解决方案:

IProgress not found. Please update jupyter and ipywidgets.Transformers 导入预训练模型报错_第1张图片

 官方文档说的很清楚:如果你的jupyter和你运行代码的kernel不是一个环境的话,按底下这么做就行。

第一步,在base环境运行:

conda install -c conda-forge widgetsnbextension

第二步,进入你的虚拟环境并运行(py36是你虚拟环境的名字,自行替换):

source activate py36
conda install -c conda-forge ipywidgets

或者直接像官方文档图那样的直接安装到指定名字的环境里面也行。

你可能感兴趣的:(AI,jupyter,python,huggingface)