bert4torch配套config
- bert4torch加载模型时候可以在线加载,无需下载文件
- Github主页
- 预训练模型支持多种代码加载方式
from bert4torch.models import build_transformer_model
model = build_transformer_model('./model/bert4torch_config.json')
model = build_transformer_model(checkpoint_path='./model')
model = build_transformer_model(checkpoint_path='./pytorch_model.bin')
model = build_transformer_model(checkpoint_path='bert-base-chinese')
config_path = './model/bert4torch_config.json'
checkpoint_path = './model/pytorch_model.bin'
model = build_transformer_model(config_path, checkpoint_path)