CUDA Word2Vec training artifact
Project description
加速Word2Vec训练的CUDA实现。
一个示例调用:
import os
from w2v_accel import train_word2vec
import time
CORPUS = "/root/word2vec_cuda/data/1bw" # 训练语料路径
OUTPUT = os.path.abspath("vectors.bin") # 输出模型路径
train_word2vec(
train=CORPUS,
output=OUTPUT,
size=128,
window=5,
negative=5,
sample=1e-3,
min_count=5,
iter=3,
binary=True,
cache_enable=True,
debug=True,
)
print(f"Output: {OUTPUT}")
print(f"Output size: {os.path.getsize(OUTPUT) / 1024 / 1024:.2f} MB")
示例输出:
(venv) root@autodl-container-9403468337-be32b5e6:~/test# python test.py
[w2v-accel] Preparing vocab, corpus and cache ...
[w2v-accel] Training started.
[w2v-accel] [████████████████████████████████] 100.00% | alpha=0.000005 | speed=94776.2k words/s
[w2v-accel] Total training time: 24.40 seconds
[w2v-accel] Training completed. Saving models to /root/test/vectors.bin ...
[w2v-accel] Done.
Output: /root/test/vectors.bin
Output size: 275.04 MB
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
w2v_accel-0.0.2.tar.gz
(2.0 MB
view details)
File details
Details for the file w2v_accel-0.0.2.tar.gz.
File metadata
- Download URL: w2v_accel-0.0.2.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f0840bee85ca7af69009947b20f2e411aa378d378f65ff16706142880744dc1
|
|
| MD5 |
f127b5ad8ed0cff6c379e26c67b53034
|
|
| BLAKE2b-256 |
52d64c570fcb15f9a701b502edc0f04008412b5275ff6a59607c3e9515fa589a
|