赞
踩
点击此处可访问SBERT官方代码(GitHub)
在安装sentence-transformers之前需要确保以下条件:
We recommend Python 3.6 or higher, PyTorch 1.6.0 or higher and transformers v4.6.0 or higher. The code does not work with Python 2.7.
点击此处可访问PyTorch官网
点击此处可查看PyTorch历史版本安装说明
pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
执行命令后的运行情况大致如下:
Looking in links: https://download.pytorch.org/whl/torch_stable.html Collecting torch===1.7.0 Using cached torch-1.7.0-cp36-none-macosx_10_9_x86_64.whl (108.0 MB) Collecting torchvision===0.8.1 Using cached torchvision-0.8.1-cp36-cp36m-macosx_10_9_x86_64.whl (1.0 MB) Collecting torchaudio===0.7.0 Downloading torchaudio-0.7.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB) |████████████████████████████████| 1.4 MB 32 kB/s Collecting dataclasses Using cached dataclasses-0.8-py3-none-any.whl (19 kB) Requirement already satisfied: typing-extensions in /anaconda/lib/python3.6/site-packages (from torch===1.7.0) (3.7.4.3) Requirement already satisfied: numpy in /anaconda/lib/python3.6/site-packages (from torch===1.7.0) (1.19.5) Requirement already satisfied: future in /anaconda/lib/python3.6/site-packages (from torch===1.7.0) (0.17.1) Requirement already satisfied: pillow>=4.1.1 in /anaconda/lib/python3.6/site-packages (from torchvision===0.8.1) (4.1.1) Requirement already satisfied: olefile in /anaconda/lib/python3.6/site-packages (from pillow>=4.1.1->torchvision===0.8.1) (0.44) Installing collected packages: dataclasses, torch, torchvision, torchaudio Attempting uninstall: torch Found existing installation: torch 1.3.1 Uninstalling torch-1.3.1: Successfully uninstalled torch-1.3.1 Successfully installed dataclasses-0.8 torch-1.7.0 torchaudio-0.7.0 torchvision-0.8.1
点击此处可访问transformers官网,可查看其安装、使用、历史版本
若直接执行
pip install transformers
会报错如下:
Building wheels for collected packages: tokenizers
Building wheel for tokenizers (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: /anaconda/bin/python /anaconda/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/4r/71h2vznj3ssgkgvt2_38rylm0000gn/T/tmp5fwt5auo
cwd: /private/var/folders/4r/7
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。