文件最后提交记录最后更新时间
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!5530 [众智][BERT-NER][PyTorch]部分参数解析新增 Merge pull request !5530 from 刘国庆/bert-ner 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!7413 BERT-NER-Pytorch、Wenet_Conformer_for_Pytorch性能优化 Merge pull request !7413 from 王凯宇/master 7 个月前
!5530 [众智][BERT-NER][PyTorch]部分参数解析新增 Merge pull request !5530 from 刘国庆/bert-ner 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
文档整改,gitee->gitcode Co-authored-by: Lighters_c<zyh13227@163.com> # message auto-generated for no-merge-commit merge: !7469 merge ffffix into master 文档整改,gitee->gitcode Created-by: addsubmuldiv Commit-by: Lighters_c Merged-by: ascend-robot Description: ## Motivation Please describe the motivation of this PR and the goal you want to achieve through this PR. ## Modification Please briefly describe what modification is made in this PR. ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [ ] The new code needs to comply with the Clean Code specification. - [ ] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [ ] CLA has been signed and all committers have signed the CLA in this PR. - [ ] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/ModelZoo-PyTorch!74695 个月前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!7376 optimize public_address_statement.md Merge pull request !7376 from 王凯宇/master 8 个月前
!6502 add bert ner 16p script Merge pull request !6502 from 卓博航/master 1 年前
Set the default parameter for allow_internal_format Co-authored-by: Ginray1<18667882700@163.com> # message auto-generated for no-merge-commit merge: !7500 merge master into master Set the default parameter for allow_internal_format Created-by: Ginray1 Commit-by: Ginray1 Merged-by: ascend-robot Description: ## Motivation Set the default parameter for allow_internal_format ## Modification Please briefly describe what modification is made in this PR. ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [√ ] The new code needs to comply with the Clean Code specification. - [ √] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [ √] CLA has been signed and all committers have signed the CLA in this PR. - [√ ] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/ModelZoo-PyTorch!75002 个月前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
!4936 讯飞BERT-NER-CRF模型初次提交 * initial commit of BERT-NER-Pytorch for iflytek 2 年前
README.md

BERT-NER-CRF for PyTorch

概述

简述

BERT-CRF 是用于自然语言处理中实体识别任务的模型

准备训练环境

该模型为随版本演进模型(随版本演进模型范围可在此处查看),您可以根据下面提供的安装指导选择匹配的CANN等软件下载使用。

准备环境

  • 推荐使用最新的版本准备训练环境。

    表 1 版本配套表

    软件 版本 安装指南
    Driver AscendHDK 25.0.RC1.1 驱动固件安装指南
    Firmware AscendHDK 25.0.RC1.1
    CANN CANN 8.1.RC1 CANN 软件安装指南
    PyTorch 2.1.0 Ascend Extension for PyTorch 配置与安装
    torch_npu release v7.0.0-pytorch2.1.0
  • 三方库依赖如下表所示

    表 2 三方库依赖表

    Torch_Version 三方库依赖版本
    PyTorch 2.1 transformers 4.29.2
  • 安装依赖

    在模型根目录下执行命令,安装模型需要的依赖。

    pip install -r requirements.txt
    

准备数据集

BERT-NER-Pytorch
└── datasets
    ├── cner
    └── cluener 
        ├── cluener_predict.json
        ├── dev.json
        ├── __init__.py 
        ├── README.md
        ├── test.json
        └── train.json

准备预训练权重

BERT-NER-Pytorch
└── prev_trained_model
    └── bert-base-chinese
        ├── config.json
        ├── pytorch_model.bin 
        ├── tokenizer_config.json
        ├── tokenizer.json
        └── vocab.txt

开始训练

运行训练脚本

  • 单机8卡训练

    bash test/train_full_8p.sh      # 8卡精度训练
    bash test/train_performance_8p.sh    # 8卡性能训练  
    
  • 单机16卡训练

    bash test/train_full_8p.sh     # 16卡精度训练
    bash test/train_performance_16p.sh    # 16卡性能训练  
    

训练完成后,权重文件保存在当前路径下,并输出模型训练精度和性能信息。

训练结果展示

表 3

Name F1 Wps Samples/Second Epochs
8p-NPU 79.16 1163.21 1129.4 4

说明:上表为历史数据,仅供参考。2025年5月10日更新的性能数据如下:

NAME 精度类型 FPS
8p-竞品 FP32 1942.15
8p-Atlas 900 A2 PoDc FP32 1407.21

版本说明

变更

2023.6.19 首次发布

FAQ

  1. 若遇到safetensors三方库报这个错误“safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge”,原因是accelerate版本 >= v0.25.0,会默认使用safetensors,导致报错。参考解决方法,安装0.24.1版本的accelerate。
    pip install accelerate==0.24.1