我尝试在社区提供的 Colab 笔记本中使用 DiffCSE 进行句子嵌入,但在安装依赖项时遇到错误。
Building wheel for transformers (pyproject.toml) ... done
Created wheel for transformers: filename=transformers-4.2.1-py3-none-any.whl size=1735899 sha256=1879670726df6662bb8f05f4491995ec7cce61e91df347d23cacbd0445338c74
Stored in directory: /root/.cache/pip/wheels/21/30/b8/6fabc5bdee11ab94071e1f2763cdae4ff641c285160031fe6e
error: subprocess-exited-with-error
× Building wheel for tokenizers (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for tokenizers (pyproject.toml) ... error
ERROR: Failed building wheel for tokenizers
这个问题可能是什么原因以及解决办法。
问题出在colab使用的python版本上,尝试将python降级到3.8版本
步骤1:
!apt-get update -y
第2步:安装Python-3.8
apt-get install python3.8 python3.8-distutils
步骤3:
!update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
第四步:
!update-alternatives --config python3
第5步:
!apt-get install python3-pip
!python3 -m pip install --upgrade pip --user