百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fastBPE

> 编程语言
开源

快速 BPE

677 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

快速 BPE

fastBPE

使用子词单元进行罕见词神经机器翻译 的 C++ 实现,具有 Python API。

安装

使用编译器:

g++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast

使用方法:

列出命令

./fast
usage: fastbpe  

The commands supported by fastBPE are:

getvocab input1 [input2]             extract the vocabulary from one or two text files
learnbpe nCodes input1 [input2]      learn BPE codes from one or two text files
applybpe output input codes [vocab]  apply BPE codes to a text file
applybpe_stream codes [vocab]        apply BPE codes to stdin and outputs to stdout

fastBPE 还支持 stdin 输入。例如,以下两个命令具有相同效果:

./fast getvocab text > vocab
cat text | ./fast getvocab - > vocab

但是第一个命令会将输入文件映射到内存中以高效读取文件,速度比 stdin 快两倍以上,对于非常大的文件而言更是如此。同样,以下两个命令具有相同的效果:

./fast applybpe output input codes vocab
cat input | ./fast applybpe_stream codes vocab > output

虽然第一种方法在大型数据集上会明显更快,因为它使用多线程来预先计算输入文件中所有单词的 BPE 分割。

学习代码

./fast learnbpe 40000 train.de train.en > codes

将代码应用于训练

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言