本文介绍: 数据转换是 Towhee 的核心;管道只是在有向无环图中连接在一起的一系列转换。所有预构建的 Towhee 管道都有代表当前任务的名称。

安装Towhee

pip3 install towhee

如果你想在 towhee安装模型

pip3 install towhee.models

打开python终端

python3

引入towhee

数据转换是 Towhee 的核心;管道只是在有向无环图中连接在一起的一系列转换。所有预构建的 Towhee 管道都有代表当前任务的名称。

from towhee import AutoPipes

声明一个 sentence_embedding 的管道

p = AutoPipes.pipeline('sentence_embedding')

运行管道,获取向量

output = p('Hello World.').get()

打印向量

print(output)

完整例子

sunyuhua@sunyuhua-HKF-WXX:~$ python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from towhee import AutoPipes
>>> p= AutoPipes.pipeline('sentence_embedding')
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Downloading https://towhee.io/sentence-embedding/transformers/resolve/bran
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy in ./.local/lib/python3.10/site-packages (from -r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 1)) (1.26.2)
Collecting transformers
  Downloading transformers-4.35.2-py3-none-any.whl (7.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.9/7.9 MB 3.9 MB/s eta 0:00:00
Collecting sentencepiece
  Downloading sentencepiece-0.1.99-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 11.5 MB/s eta 0:00:00
Requirement already satisfied: protobuf in ./.local/lib/python3.10/site-packages (from -r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 4)) (4.25.0)
Requirement already satisfied: towhee in ./.local/lib/python3.10/site-packages (from -r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (1.1.2)
Collecting torch
  Downloading torch-2.1.1-cp310-cp310-manylinux1_x86_64.whl (670.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 490.6/670.2 MB 7.2 MB/s eta 0:00:25     ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 493.0/670.2 MB 7.3 MB/s eta 0:00:25     ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 493.0/670.2 MB 7.3 MB/s eta 0:00:25     ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 493.0/670.2 MB 7.3 MB/s eta 0:00:25     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 670.2/670.2 MB 4.3 MB/s eta 0:00:00
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 2)) (23.2)
Collecting safetensors>=0.3.1
  Downloading safetensors-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 12.3 MB/s eta 0:00:00
Requirement already satisfied: pyyaml>=5.1 in /usr/lib/python3/dist-packages (from transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 2)) (5.4.1)
Requirement already satisfied: tqdm>=4.27 in ./.local/lib/python3.10/site-packages (from transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 2)) (4.66.1)
Collecting regex!=2019.12.17
  Downloading regex-2023.10.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (773 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 773.9/773.9 KB 29.4 MB/s eta 0:00:00
Collecting filelock
  Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 2)) (2.25.1)
Collecting tokenizers<0.19,>=0.14
  Downloading tokenizers-0.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 7.9 MB/s eta 0:00:00
Collecting huggingface-hub<1.0,>=0.16.4
  Downloading huggingface_hub-0.19.4-py3-none-any.whl (311 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 311.7/311.7 KB 136.8 MB/s eta 0:00:00
Requirement already satisfied: tenacity in ./.local/lib/python3.10/site-packages (from towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (8.2.3)
Requirement already satisfied: twine in ./.local/lib/python3.10/site-packages (from towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (4.0.2)
Requirement already satisfied: pydantic<2 in ./.local/lib/python3.10/site-packages (from towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (1.10.13)
Requirement already satisfied: tabulate in ./.local/lib/python3.10/site-packages (from towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (0.9.0)
Requirement already satisfied: typing-extensions in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 7)) (4.8.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 7)) (3.1.2)
Collecting fsspec
  Downloading fsspec-2023.10.0-py3-none-any.whl (166 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 166.4/166.4 KB 11.7 MB/s eta 0:00:00
Collecting nvidia-cuda-cupti-cu12==12.1.105
  Downloading nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (14.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.1/14.1 MB 6.8 MB/s eta 0:00:00
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/nvidia-nccl-cu12/
Collecting nvidia-nccl-cu12==2.18.1
  Downloading nvidia_nccl_cu12-2.18.1-py3-none-manylinux1_x86_64.whl (209.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 209.8/209.8 MB 4.8 MB/s eta 0:00:00
Collecting nvidia-nvtx-cu12==12.1.105
  Downloading nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (99 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.1/99.1 KB 7.8 MB/s eta 0:00:00
Collecting nvidia-curand-cu12==10.3.2.106
  Downloading nvidia_curand_cu12-10.3.2.106-py3-none-manylinux1_x86_64.whl (56.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.5/56.5 MB 7.1 MB/s eta 0:00:00
Collecting nvidia-cudnn-cu12==8.9.2.26
  Downloading nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl (731.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 731.7/731.7 MB 3.0 MB/s eta 0:00:00
Collecting nvidia-cusolver-cu12==11.4.5.107
  Downloading nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl (124.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 124.2/124.2 MB 5.6 MB/s eta 0:00:00
Collecting nvidia-cufft-cu12==11.0.2.54
  Downloading nvidia_cufft_cu12-11.0.2.54-py3-none-manylinux1_x86_64.whl (121.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.6/121.6 MB 5.1 MB/s eta 0:00:00
Collecting nvidia-cuda-nvrtc-cu12==12.1.105
  Downloading nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (23.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.7/23.7 MB 5.7 MB/s eta 0:00:00
Collecting nvidia-cublas-cu12==12.1.3.1
  Downloading nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl (410.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 410.6/410.6 MB 4.9 MB/s eta 0:00:00
Collecting nvidia-cusparse-cu12==12.1.0.106
  Downloading nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl (196.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 196.0/196.0 MB 6.4 MB/s eta 0:00:00
Collecting triton==2.1.0
  Downloading triton-2.1.0-0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (89.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 MB 5.3 MB/s eta 0:00:00
Collecting sympy
  Downloading sympy-1.12-py3-none-any.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 3.3 MB/s eta 0:00:00
Collecting nvidia-cuda-runtime-cu12==12.1.105
  Downloading nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (823 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 823.6/823.6 KB 6.8 MB/s eta 0:00:00
Collecting networkx
  Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 6.5 MB/s eta 0:00:00
Collecting nvidia-nvjitlink-cu12
  Downloading nvidia_nvjitlink_cu12-12.3.101-py3-none-manylinux1_x86_64.whl (20.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 20.5/20.5 MB 8.4 MB/s eta 0:00:00
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2->torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 7)) (2.0.1)
Collecting mpmath>=0.19
  Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 KB 2.1 MB/s eta 0:00:00
Requirement already satisfied: urllib3>=1.26.0 in /usr/lib/python3/dist-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (1.26.5)
Requirement already satisfied: readme-renderer>=35.0 in ./.local/lib/python3.10/site-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (42.0)
Requirement already satisfied: importlib-metadata>=3.6 in /usr/lib/python3/dist-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (4.6.4)
Requirement already satisfied: requests-toolbelt!=0.9.0,>=0.8.0 in /usr/lib/python3/dist-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (0.9.1)
Requirement already satisfied: rfc3986>=1.4.0 in ./.local/lib/python3.10/site-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (2.0.0)
Requirement already satisfied: pkginfo>=1.8.1 in ./.local/lib/python3.10/site-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (1.9.6)
Requirement already satisfied: rich>=12.0.0 in ./.local/lib/python3.10/site-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (13.7.0)
Requirement already satisfied: keyring>=15.1 in /usr/lib/python3/dist-packages (from twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (23.5.0)
Requirement already satisfied: docutils>=0.13.1 in ./.local/lib/python3.10/site-packages (from readme-renderer>=35.0->twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (0.20.1)
Requirement already satisfied: nh3>=0.2.14 in ./.local/lib/python3.10/site-packages (from readme-renderer>=35.0->twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (0.2.14)
Requirement already satisfied: Pygments>=2.5.1 in ./.local/lib/python3.10/site-packages (from readme-renderer>=35.0->twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (2.17.2)
Requirement already satisfied: markdown-it-py>=2.2.0 in ./.local/lib/python3.10/site-packages (from rich>=12.0.0->twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (3.0.0)
Requirement already satisfied: mdurl~=0.1 in ./.local/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich>=12.0.0->twine->towhee->-r /home/sunyuhua/.towhee/operators/sentence-embedding/transformers/versions/main/requirements.txt (line 6)) (0.1.2)
Installing collected packages: sentencepiece, mpmath, sympy, safetensors, regex, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, networkx, fsspec, filelock, triton, nvidia-cusparse-cu12, nvidia-cudnn-cu12, huggingface-hub, tokenizers, nvidia-cusolver-cu12, transformers, torch
Successfully installed filelock-3.13.1 fsspec-2023.10.0 huggingface-hub-0.19.4 mpmath-1.3.0 networkx-3.2.1 nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.18.1 nvidia-nvjitlink-cu12-12.3.101 nvidia-nvtx-cu12-12.1.105 regex-2023.10.3 safetensors-0.4.0 sentencepiece-0.1.99 sympy-1.12 tokenizers-0.15.0 torch-2.1.1 transformers-4.35.2 triton-2.1.0
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Downloading https://towhee.io/sentence-embedding/sbert/resolve/branch/main
Defaulting to user installation because normal site-packages is not writeable
Collecting sentence_transformers
  Downloading sentence-transformers-2.2.2.tar.gz (85 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.0/86.0 KB 165.0 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch in ./.local/lib/python3.10/site-packages (from -r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (2.1.1)
Requirement already satisfied: huggingface-hub>=0.4.0 in ./.local/lib/python3.10/site-packages (from sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (0.19.4)
Collecting nltk
  Downloading nltk-3.8.1-py3-none-any.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 2.1 MB/s eta 0:00:00
Requirement already satisfied: numpy in ./.local/lib/python3.10/site-packages (from sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (1.26.2)
Collecting scikit-learn
  Downloading scikit_learn-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.8/10.8 MB 5.3 MB/s eta 0:00:00
Collecting scipy
  Downloading scipy-1.11.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (36.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.4/36.4 MB 5.4 MB/s eta 0:00:00
Requirement already satisfied: sentencepiece in ./.local/lib/python3.10/site-packages (from sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (0.1.99)
Collecting torchvision
  Downloading torchvision-0.16.1-cp310-cp310-manylinux1_x86_64.whl (6.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 10.3 MB/s eta 0:00:00
Requirement already satisfied: tqdm in ./.local/lib/python3.10/site-packages (from sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (4.66.1)
Requirement already satisfied: transformers<5.0.0,>=4.6.0 in ./.local/lib/python3.10/site-packages (from sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (4.35.2)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.105)
Requirement already satisfied: triton==2.1.0 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (2.1.0)
Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (2.18.1)
Requirement already satisfied: filelock in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (3.13.1)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (8.9.2.26)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (11.4.5.107)
Requirement already satisfied: typing-extensions in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (4.8.0)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.0.106)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.105)
Requirement already satisfied: fsspec in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (2023.10.0)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.3.1)
Requirement already satisfied: sympy in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (1.12)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (3.1.2)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (10.3.2.106)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.105)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.1.105)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (11.0.2.54)
Requirement already satisfied: networkx in ./.local/lib/python3.10/site-packages (from torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (3.2.1)
Requirement already satisfied: nvidia-nvjitlink-cu12 in ./.local/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (12.3.101)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from huggingface-hub>=0.4.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (2.25.1)
Requirement already satisfied: pyyaml>=5.1 in /usr/lib/python3/dist-packages (from huggingface-hub>=0.4.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (5.4.1)
Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.4.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (23.2)
Requirement already satisfied: safetensors>=0.3.1 in ./.local/lib/python3.10/site-packages (from transformers<5.0.0,>=4.6.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (0.4.0)
Requirement already satisfied: regex!=2019.12.17 in ./.local/lib/python3.10/site-packages (from transformers<5.0.0,>=4.6.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (2023.10.3)
Requirement already satisfied: tokenizers<0.19,>=0.14 in ./.local/lib/python3.10/site-packages (from transformers<5.0.0,>=4.6.0->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (0.15.0)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2->torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (2.0.1)
Collecting joblib
  Downloading joblib-1.3.2-py3-none-any.whl (302 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 302.2/302.2 KB 3.8 MB/s eta 0:00:00
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from nltk->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (8.0.3)
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-3.2.0-py3-none-any.whl (15 kB)
Requirement already satisfied: mpmath>=0.19 in ./.local/lib/python3.10/site-packages (from sympy->torch->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 2)) (1.3.0)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/lib/python3/dist-packages (from torchvision->sentence_transformers->-r /home/sunyuhua/.towhee/operators/sentence-embedding/sbert/versions/main/requirements.txt (line 1)) (9.0.1)
Building wheels for collected packages: sentence_transformers
  Building wheel for sentence_transformers (setup.py) ... done
  Created wheel for sentence_transformers: filename=sentence_transformers-2.2.2-py3-none-any.whl size=125940 sha256=ca4925acf55f71b2f1604eadef86cf5a46abc1216d0fca835055a1aed0cd607b
  Stored in directory: /home/sunyuhua/.cache/pip/wheels/62/f2/10/1e606fd5f02395388f74e7462910fe851042f97238cbbd902f
Successfully built sentence_transformers
Installing collected packages: threadpoolctl, scipy, joblib, scikit-learn, nltk, torchvision, sentence_transformers
Successfully installed joblib-1.3.2 nltk-3.8.1 scikit-learn-1.3.2 scipy-1.11.4 sentence_transformers-2.2.2 threadpoolctl-3.2.0 torchvision-0.16.1
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: torch in ./.local/lib/python3.10/site-packages (2.1.1)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in ./.local/lib/python3.10/site-packages (from torch) (12.1.3.1)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in ./.local/lib/python3.10/site-packages (from torch) (12.1.0.106)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in ./.local/lib/python3.10/site-packages (from torch) (11.0.2.54)
Requirement already satisfied: networkx in ./.local/lib/python3.10/site-packages (from torch) (3.2.1)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch) (12.1.105)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in ./.local/lib/python3.10/site-packages (from torch) (11.4.5.107)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch) (3.1.2)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in ./.local/lib/python3.10/site-packages (from torch) (8.9.2.26)
Requirement already satisfied: triton==2.1.0 in ./.local/lib/python3.10/site-packages (from torch) (2.1.0)
Requirement already satisfied: fsspec in ./.local/lib/python3.10/site-packages (from torch) (2023.10.0)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch) (12.1.105)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in ./.local/lib/python3.10/site-packages (from torch) (12.1.105)
Requirement already satisfied: filelock in ./.local/lib/python3.10/site-packages (from torch) (3.13.1)
Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in ./.local/lib/python3.10/site-packages (from torch) (2.18.1)
Requirement already satisfied: sympy in ./.local/lib/python3.10/site-packages (from torch) (1.12)
Requirement already satisfied: typing-extensions in ./.local/lib/python3.10/site-packages (from torch) (4.8.0)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in ./.local/lib/python3.10/site-packages (from torch) (10.3.2.106)
Requirement already satisfied: nvidia-nvjitlink-cu12 in ./.local/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch) (12.3.101)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3/dist-packages (from jinja2->torch) (2.0.1)
Requirement already satisfied: mpmath>=0.19 in ./.local/lib/python3.10/site-packages (from sympy->torch) (1.3.0)
config.json: 100%|███████████████████████| 612/612 [00:00<00:00, 4.73MB/s]
pytorch_model.bin: 100%|█████████████| 90.9M/90.9M [00:14<00:00, 6.30MB/s]
tokenizer_config.json: 100%|█████████████| 350/350 [00:00<00:00, 3.82MB/s]
vocab.txt: 100%|████████████████████████| 232k/232k [00:00<00:00, 528kB/s]
tokenizer.json: 100%|██████████████████| 466k/466k [00:00<00:00, 1.90MB/s]
special_tokens_map.json: 100%|████████████| 112/112 [00:00<00:00, 940kB/s]
Downloading https://towhee.io/towhee/np-normalize/resolve/branch/main/np_n
Downloading https://towhee.io/towhee/np-normalize/resolve/branch/main/.git
Downloading https://towhee.io/towhee/np-normalize/resolve/branch/main/__in
Downloading https://towhee.io/towhee/np-normalize/resolve/branch/main/READ
>>> output=p('Helloe world').get()
>>> print(output)
[array([-3.92712355e-02,  4.80684116e-02,  5.95900044e-02,  1.50823481e-02,
       -3.66780087e-02, -1.32219031e-01,  8.31967071e-02,  5.79769490e-03,
       -3.96223888e-02,  3.07036918e-02,  2.89014447e-02, -2.16738917e-02,
        3.96066383e-02, -1.26579404e-03,  6.08291477e-03, -4.24210764e-02,
        2.01249309e-03, -1.86294317e-02, -1.62907511e-01, -4.34840433e-02,
        1.62143987e-02,  4.67299707e-02, -1.82608850e-02,  3.45673971e-02,
       -9.05647129e-02, -3.47076058e-02,  4.95730639e-02,  5.69570959e-02,
        1.19595500e-02, -4.77556735e-02,  6.35083839e-02,  4.12026607e-02,
        9.86057967e-02, -1.17613534e-02, -1.07729221e-02,  4.72074673e-02,
        1.53425299e-02, -1.17951781e-01, -4.07279357e-02,  6.00408837e-02,
        4.97895367e-02, -6.72062561e-02, -3.99538539e-02, -4.53739874e-02,
       -2.43957136e-02,  2.54855468e-03,  4.04100493e-03,  9.58379824e-03,
        8.11471865e-02, -1.00173652e-02, -6.16754815e-02, -9.89144370e-02,
       -2.37130634e-02, -2.60085985e-02,  8.42589885e-02,  4.11129408e-02,
        5.48722558e-02, -2.05888506e-02,  5.15442006e-02, -3.72264795e-02,
       -4.96201962e-02, -1.45055773e-02,  1.67905763e-02,  2.55229399e-02,
        9.70870554e-02, -5.40696681e-02, -2.54421458e-02,  6.83117732e-02,
       -6.61522299e-02, -1.06353819e-01, -5.85339628e-02, -2.45088823e-02,
       -4.09027748e-02,  9.88629311e-02, -4.79994565e-02,  4.11606841e-02,
        4.14730655e-03,  1.14888959e-02, -1.60149336e-02,  2.26610713e-02,
        7.61725456e-02, -8.79915208e-02,  3.42002325e-02,  1.09161306e-02,
        3.01623382e-02, -3.11465468e-03, -6.25403319e-03,  2.49127322e-03,
        3.04438313e-03, -3.21908891e-02, -1.47315025e-01, -2.32012197e-02,
        1.22349914e-02,  1.53391052e-03, -6.35076985e-02, -3.18302289e-02,
        7.32990503e-02, -2.36478075e-02, -1.44521892e-01,  2.07271844e-01,
        2.32338887e-02,  3.75737511e-02,  3.08225360e-02,  7.39266649e-02,
        9.03519765e-02, -3.32734111e-04,  6.13446767e-03,  4.76187579e-02,
       -3.54514234e-02, -2.89245993e-02, -4.97184172e-02, -3.36960480e-02,
        5.10365963e-02, -2.33562365e-02,  7.00538009e-02, -7.42424130e-02,
        3.15285102e-03,  2.38933582e-02, -1.42441709e-02, -2.18961053e-02,
        4.06182632e-02, -3.12631465e-02,  3.18319686e-02,  1.22786863e-02,
       -2.21013604e-03,  5.66747505e-03,  5.05792238e-02, -2.31724356e-33,
        6.68374375e-02, -3.98995634e-03,  6.75902739e-02,  1.12693615e-01,
        2.07344834e-02,  7.34202052e-03, -8.40339512e-02,  1.22713977e-02,
        5.13319969e-02, -1.83858862e-03,  2.57237088e-02,  1.57117825e-02,
       -5.18067814e-02,  1.33342287e-02,  3.17621902e-02,  3.17705274e-02,
       -3.33195925e-02,  4.14141119e-02, -5.28809167e-02,  7.29836375e-02,
       -6.11906312e-02, -2.84734108e-02,  5.37402518e-02,  8.27277601e-02,
        9.01935995e-03,  1.64196212e-02, -7.87262339e-03, -9.19852927e-02,
        6.52198195e-02, -1.98992435e-02,  2.17003450e-02, -3.71806026e-02,
       -4.97720111e-03,  7.85227050e-04, -1.28043676e-02, -7.72262970e-03,
        1.32672284e-02, -7.73456842e-02, -7.91700482e-02,  1.83501299e-02,
       -6.45067394e-02,  3.29789706e-02,  3.88198718e-02, -2.92733163e-02,
        3.56227010e-02, -1.27962092e-03, -1.20699331e-02, -1.69705541e-03,
        6.19954355e-02,  6.18568473e-02, -2.14913730e-02, -4.17424273e-03,
       -7.95829371e-02,  3.25059891e-02, -1.32910050e-02,  2.30285451e-02,
        3.10850125e-02,  1.81144457e-02,  4.38471399e-02,  4.01889719e-02,
        3.47480327e-02,  8.48527774e-02, -1.93069465e-02,  8.35231505e-03,
       -1.39988726e-02,  1.87451276e-03,  4.84388322e-02,  1.38944946e-02,
        3.68431658e-02,  1.08674085e-02, -2.22682115e-02,  4.39764757e-04,
        3.23627070e-02,  8.50657970e-02,  3.76857258e-02,  2.93367673e-02,
        9.69080552e-02, -1.61075462e-02,  2.89528817e-03, -7.89317191e-02,
        4.19793418e-03,  2.44596731e-02,  4.38375250e-02, -1.74270663e-02,
        1.10297389e-01, -2.17470769e-02,  6.07274845e-03, -1.01939522e-01,
       -3.18767466e-02,  1.02431616e-02, -7.55928457e-02,  3.78221534e-02,
        4.15107310e-02, -5.67039996e-02, -8.73704776e-02,  2.12949526e-33,
        9.43206400e-02,  3.51214223e-02, -2.58800518e-02, -4.59745042e-02,
       -3.06473337e-02, -3.45196612e-02, -9.12020802e-02,  1.77316502e-01,
       -8.39436650e-02,  3.82055007e-02,  4.19548191e-02, -1.00017537e-03,
        1.71365872e-01,  2.37408411e-02,  4.73533161e-02, -4.89858240e-02,
        1.14776216e-01, -5.04516484e-03,  8.05438403e-03, -1.89752632e-03,
        2.64074025e-03, -6.00041449e-02, -4.10351157e-02,  1.08298371e-02,
        1.99004868e-03, -5.85656380e-03,  1.70178432e-02,  2.50522047e-02,
       -1.02582149e-01,  3.42398435e-02,  1.41481459e-02,  4.97529991e-02,
       -1.36443991e-02,  3.12903523e-02, -3.86525653e-02,  4.32265811e-02,
       -7.38892630e-02, -3.29974294e-02,  6.46605017e-03, -4.97235581e-02,
       -8.52587074e-02, -1.70856081e-02, -4.53200080e-02,  3.01137529e-02,
       -9.03768316e-02,  9.18088667e-03, -8.85297209e-02, -4.15285397e-03,
       -1.46412812e-02,  1.25364168e-02, -5.58873788e-02, -1.99121945e-02,
        2.51157656e-02, -6.89534470e-02, -5.34452982e-02, -1.93405412e-02,
       -5.25956489e-02, -1.60101950e-02, -9.05408245e-03, -1.86924785e-02,
        2.00051982e-02,  3.53172943e-02,  1.29960505e-02,  5.61581664e-02,
       -3.14091109e-02, -4.12965268e-02, -3.59972827e-02,  9.52887386e-02,
        3.38107944e-02, -2.46737879e-02,  2.03528395e-03,  1.60372108e-02,
       -4.13888730e-02, -2.26332899e-02, -1.25040608e-02,  4.21831198e-02,
       -2.71738470e-02,  2.27758083e-02,  5.38989343e-03,  4.42225067e-03,
       -3.39115262e-02,  1.52577404e-02, -1.43890744e-02,  1.01844082e-02,
        8.67430214e-03,  3.09674144e-02,  4.56901155e-02,  4.82268855e-02,
       -2.44879257e-02, -6.97402954e-02,  1.10555356e-02,  1.04801366e-02,
       -9.71416198e-03,  3.17044444e-02, -6.23643957e-02, -1.66390350e-08,
       -3.54752727e-02,  8.04685894e-03,  4.92555264e-04,  5.45148924e-02,
       -1.90586771e-03, -2.91209714e-03, -2.02808268e-02, -3.85590456e-02,
       -6.76029846e-02,  5.01464196e-02,  5.67333065e-02,  6.52029663e-02,
       -7.37550855e-02,  1.76994968e-02,  3.26675288e-02,  6.99705556e-02,
       -5.81898838e-02,  2.60485820e-02, -3.08649205e-02,  4.14206870e-02,
        5.91574460e-02,  2.85533424e-02,  1.05210934e-02, -6.14822134e-02,
        3.10562123e-02, -6.66212216e-02, -2.82393470e-02,  2.47371979e-02,
       -4.19432595e-02, -7.03336149e-02,  5.54722957e-02,  9.39245895e-02,
       -3.73507030e-02,  2.35748682e-02, -3.86635289e-02,  2.64607975e-03,
       -4.07757657e-03,  7.51827285e-02,  3.38469222e-02, -6.91396371e-02,
       -6.41979128e-02,  7.02679232e-02,  6.19985396e-03, -1.00558341e-01,
       -3.62053625e-02,  7.05183372e-02,  7.85375684e-02, -4.61720638e-02,
       -1.17652714e-02, -8.04601014e-02, -6.84763566e-02,  7.15725590e-03,
        1.00846678e-01, -1.72636192e-02,  7.78734758e-02,  6.90076500e-02,
        1.13957608e-02,  5.33638336e-02, -9.82133765e-03,  2.31002476e-02,
        3.17580774e-02, -3.47820967e-02,  5.91505617e-02, -1.53853577e-02],
      dtype=float32)]
>>> 

原文地址:https://blog.csdn.net/sunyuhua_keyboard/article/details/134551634

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_3579.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注