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
ModelZoo
BERT_onnxruntime
Commits
b66a1735
Commit
b66a1735
authored
Oct 10, 2023
by
yangql
Browse files
修改格式
parent
b9bb0b64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
README.md
README.md
+17
-16
No files found.
README.md
View file @
b66a1735
...
@@ -27,6 +27,7 @@ docker run --shm-size 16g --network=host --name=bert_ort --privileged --device=/
...
@@ -27,6 +27,7 @@ docker run --shm-size 16g --network=host --name=bert_ort --privileged --device=/
# 激活dtk
# 激活dtk
source /opt/dtk/env.sh
source /opt/dtk/env.sh
```
```
## 数据集
## 推理
## 推理
### Python版本推理
### Python版本推理
...
@@ -35,7 +36,7 @@ source /opt/dtk/env.sh
...
@@ -35,7 +36,7 @@ source /opt/dtk/env.sh
```
```
export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
```
```
####
安装依赖
####
运行示例
```
python
```
python
# 进入bert ort工程根目录
# 进入bert ort工程根目录
cd
<
path_to_bert_ort
>
cd
<
path_to_bert_ort
>
...
@@ -45,19 +46,11 @@ cd Python/
...
@@ -45,19 +46,11 @@ cd Python/
# 安装依赖
# 安装依赖
pip
install
-
r
requirements
.
txt
pip
install
-
r
requirements
.
txt
```
###
# 运行示例
# 运行示例
```
python
python
bert
.
py
python
bert
.
py
```
```
输出结果为:
```
“1”:"open-source exascale-class platform for accelerated computing",
"2":"(Tensorflow / PyTorch)",
"3":"scale"
```
输出结果中,问题id对应预测概率值最大的答案。
### C++版本推理
### C++版本推理
本次采用经典的Bert模型完成问题回答任务,模型和分词文件下载链接:https://pan.baidu.com/s/1yc30IzM4ocOpTpfFuUMR0w, 提取码:8f1a, 将bertsquad-10.onnx文件和uncased_L-12_H-768_A-12分词文件保存在Resource/文件夹下。下面介绍如何运行C++代码示例,C++示例的详细说明见Doc目录下的Tutorial_Cpp.md。
本次采用经典的Bert模型完成问题回答任务,模型和分词文件下载链接:https://pan.baidu.com/s/1yc30IzM4ocOpTpfFuUMR0w, 提取码:8f1a, 将bertsquad-10.onnx文件和uncased_L-12_H-768_A-12分词文件保存在Resource/文件夹下。下面介绍如何运行C++代码示例,C++示例的详细说明见Doc目录下的Tutorial_Cpp.md。
...
@@ -76,7 +69,7 @@ source ~/.bashrc
...
@@ -76,7 +69,7 @@ source ~/.bashrc
source /opt/dtk/env.sh
source /opt/dtk/env.sh
```
```
#### 运行示例
#### 运行示例
```
python
```
c++
# 进入bert ort工程根目录
# 进入bert ort工程根目录
cd
<
path_to_bert_ort
>
cd
<
path_to_bert_ort
>
...
@@ -86,7 +79,15 @@ cd build/
...
@@ -86,7 +79,15 @@ cd build/
# 执行示例程序
# 执行示例程序
.
/
Bert
.
/
Bert
```
```
如下所示,在当前界面根据提示输入问题,得到预测答案。
## result
### python版本
```
“1”:"open-source exascale-class platform for accelerated computing",
"2":"(Tensorflow / PyTorch)",
"3":"scale"
```
### C++版本
```
```
question:What is ROCm?
question:What is ROCm?
answer:open-source exascale-class platform for accelerated computing
answer:open-source exascale-class platform for accelerated computing
...
@@ -95,16 +96,16 @@ answer:tensorflow / pytorch
...
@@ -95,16 +96,16 @@ answer:tensorflow / pytorch
question:What is ROCm built for?
question:What is ROCm built for?
answer:scale
answer:scale
```
```
## 应用场景
## 应用场景
### 算法类别
### 算法类别
`对话问答`
`对话问答`
### 热点应用行业
### 热点应用行业
`零售`
、
`医疗`
、
`教育`
`零售`
,
`医疗`
,
`教育`
## 源码仓库及问题反馈
## 源码仓库及问题反馈
https://developer.hpccube.com/codes/modelzoo/bert_ort
https://developer.hpccube.com/codes/modelzoo/bert_ort
## 参考资料
## 参考资料
https://github.com/ROCmSoftwarePlatform/onnxruntime/blob/81120e9e8b377567daa00d55614c902f35b2ae8f/onnxruntime/python/tools/transformers/onnx_model_bert.py
https://github.com/ROCmSoftwarePlatform/onnxruntime/blob/81120e9e8b377567daa00d55614c902f35b2ae8f/onnxruntime/python/tools/transformers/onnx_model_bert.py
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