python-3.x - 为什么 spacy 管道不使用多个线程或进程?
问题描述
import spacy
nlp = spacy.blank("en")
nlp.add_pipe(nlp.create_pipe("sentencizer"))
s = [u"This is a sentence. This is another sentence."*500] * 10000
from time import monotonic as m
start = m()
for x in nlp.pipe(s, n_threads=-1):
c = [c for c in x]
print(m()-start)
为什么在这个代码示例中,spacy 没有使用多线程或处理?
解决方案
推荐阅读
- android - 电子邮件 Gmail 后台安全异常
- amazon-web-services - 是否可以使用在打包程序配置程序上运行的脚本的输出来为生成的 AMI 创建标签?
- python - 获取真值的长度
- dotnetnuke-7 - DNN - 在 javascript 中获取用户角色
- octopus-deploy - 一个版本可以有多个章鱼部署过程吗?
- c# - 从 git bash 窗口管道到 .NET 应用程序时,STDIN 停止
- python - 计算熊猫数据框列值和给定字符串之间的编辑距离
- javascript - 尝试引用 index.js 文件时,Visual Studio 无法识别 src 属性
- sql-server - 如何在 SQL 中检查数据库以确保其所有表都在使用中?
- python - 如何为 numpy ndarray 提供浮点索引?