1.创建虚拟环境
conda create -n Distil3.7 python=3.7
2.进入虚拟环境
source activate Distil3.7
3.下载transformers
conda install -c huggingface transformers
4.下载pytorch
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
5.验证是否安装成功
python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
5.1 出现报错解决:
pip install -U transformers
pip install -U huggingface_hub
pip install "sagemaker>=2.69.0" "transformers==4.12.3"