Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
panhb
bert_tensorflow
Commits
8eee5634
Commit
8eee5634
authored
Oct 10, 2023
by
hepj987
Browse files
标准格式
parent
a2ce33be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
README.md
README.md
+18
-20
model.properties
model.properties
+5
-3
No files found.
README.md
View file @
8eee5634
#
BERT-TF2
#
bert_tensorflow
## 论文
...
...
@@ -70,6 +70,8 @@ squad-v1.1 eval脚本:[evaluate-v1.1.py](https://github.com/allenai/bi-att-flo
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.7.0-centos7.6-dtk-22.10.1-py37-latest
docker run -dit --network=host --name=bert_tensorflow --privileged --device=/dev/kfd --device=/dev/dri --ipc=host --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -u root --ulimit stack=-1:-1 --ulimit memlock=-1:-1 image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.7.0-centos7.6-dtk-22.10.1-py37-latest
docker exec -it bert_tensorflow /bin/bash
```
安装过程可能顶掉DCU版本的tensorflow,可以到
[
开发者社区
](
https://cancon.hpccube.com:65024/4/main/tensorflow/dtk22.10
)
下载DCU版本对应包
...
...
@@ -78,9 +80,9 @@ docker pull image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.7.0-centos7.6-d
pip install requirements.txt
```
##
MNLI分类
训练
## 训练
### 数据转化
### 数据转化
-MNLI
TF2.0版本读取数据需要转化为tf_record格式
...
...
@@ -106,7 +108,7 @@ python create_finetuning_data.py \
--classification_task_name 分类任务名
```
### 模型转化
### 模型转化
-MNLI
TF2.7.2与TF1.15.0模型存储、读取格式不同,官网给出的Bert一般是基于TF1.0的模型需要进行模型转化
...
...
@@ -125,7 +127,7 @@ python3 tf2_encoder_checkpoint_converter.py \
bert_model.ckpt-1.index改为 bert_model.ckpt.index
```
### 单卡运行
### 单卡运行
-MNLI
```
sh bert_class.sh
...
...
@@ -146,15 +148,13 @@ sh bert_class.sh
--num_gpus 使用gpu数量
```
### 多卡运行
### 多卡运行
-MNLI
```
sh bert_class_gpus.sh
```
## SQUAD1.1问答训练
### 数据转化
### 数据转化-SQUAD1.1
TF2.0版本读取数据需要转化为tf_record格式
...
...
@@ -179,7 +179,7 @@ python3 create_finetuning_data.py \
--max_seq_length 最大句子长度
```
### 模型转化
### 模型转化
-SQUAD1.1
```
python3 tf2_encoder_checkpoint_converter.py \
...
...
@@ -196,7 +196,7 @@ python3 tf2_encoder_checkpoint_converter.py \
bert_model.ckpt-1.index改为 bert_model.ckpt.index
```
### 单卡运行
### 单卡运行
-SQUAD1.1
```
sh bert_squad.sh
...
...
@@ -219,13 +219,13 @@ sh bert_squad.sh
--num_gpus 使用gpu数量
```
### 多卡运行
### 多卡运行
-SQUAD1.1
```
sh bert_squad_gpus.sh
```
##
模型
精度
## 精度
使用单张Z100收敛性如下所示:
...
...
@@ -234,22 +234,20 @@ sh bert_squad_gpus.sh
| MNLI-class(单卡) | val_accuracy: 0.7387 |
| squad1.1(单卡) | F1-score:0.916378 |
## 应用场景
`文本分类、智能问答`
# 应用场景
## 算法类别
`自然语言处理`
`自然语言处理
、文本分类、智能问答
`
## 热点行业
## 热点
应用
行业
`互联网`
#
# 源码仓库及问题反馈
# 源码仓库及问题反馈
https://developer.hpccube.com/codes/modelzoo/bert-tf2
#
# 参考
# 参考
https://github.com/tensorflow/models/tree/v2.3.0/official/nlp
model.properties
View file @
8eee5634
# 模型唯一标识
modelCode
=
281
# 模型名称
modelName
=
B
ert
-TF2
modelName
=
b
ert
_tensorflow
# 模型描述
modelDescription
=
B
ert是一种预训练的语言表征模型。
modelDescription
=
b
ert是一种预训练的语言表征模型。
# 应用场景
appScenario
=
训练,NLP,文本分类,文本问答
# 框架类型
frameType
=
T
ensorflow
2
frameType
=
t
ensorflow
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment