当前位置:   article > 正文

安装sentence-transformers_sentence_transformers安装

sentence_transformers安装

点击此处可访问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官网
点击此处可查看PyTorch历史版本安装说明

pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
  • 1

执行命令后的运行情况大致如下:

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
二、安装transformers

点击此处可访问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
  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/403090
推荐阅读
相关标签
  

闽ICP备14008679号