Swarm Intelligence in Python
Project description
pybert
预训练语言模型
bert模型放在 bert_pretain目录下,三个文件:
- pytorch_model.bin
- bert_config.json
- vocab.txt
预训练模型下载地址:
bert_Chinese: 模型 https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese.tar.gz
词表 https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-vocab.txt
来自这里
备用:模型的网盘地址:https://pan.baidu.com/s/123VJOsbHyi6RW0zyvOG0Ow?pwd=lq7a
训练数据下载
训练和预测
训练
from pybert.models import bert
from pybert.train_eval import load_and_train
dataset = 'THUCNews' # 数据集
logfile = 'log.txt' # 日志文件
config = bert.Config(dataset, logfile=logfile)
load_and_train(config)
预测
# coding: UTF-8
import pybert.models.bert as bert
from pybert.train_eval import Prediction
config = bert.Config(dataset='THUCNews')
prediction = Prediction(config)
sentences = ['野兽用纪录打爆第二中锋 掘金版三巨头已巍然成型'] # * 128
predict_label, score = prediction.predict(sentences)
print("predict label:")
print(predict_label)
对应论文
[1] BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybert-0.0.1.tar.gz.
File metadata
- Download URL: pybert-0.0.1.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee262cb4c6f4776592071baa9314ab5786d9398c03871287fbe55e24650a336
|
|
| MD5 |
34d723cf58c29023c5915781e8eab18e
|
|
| BLAKE2b-256 |
4f65a6b7dee82337e0e513abc23c9b0bd476924ad8893be1f2970ab869a46459
|
File details
Details for the file pybert-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pybert-0.0.1-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
724f33877a0b4ce97aa74c4820eada7df359abb34422ee4f451453ca7d664b0e
|
|
| MD5 |
3314f4e4ede24c488d4fec9754f063d0
|
|
| BLAKE2b-256 |
5463e3d82f253158bfe24a3eff456b2695610c34a8bbdd0e5a3ca75f581ec7f5
|