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
38275d3b
Commit
38275d3b
authored
Oct 08, 2023
by
yangql
Browse files
Update README.md
parent
54c246bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
25 deletions
+7
-25
README.md
README.md
+7
-25
No files found.
README.md
View file @
38275d3b
...
...
@@ -11,25 +11,18 @@ BERT的全称为Bidirectional Encoder Representation from Transformers,是一
## 推理
### Python版本推理
本次采用经典的Bert模型完成问题回答任务,模型和分词文件下载链接:https://pan.baidu.com/s/1yc30IzM4ocOpTpfFuUMR0w, 提取码:8f1a, 将bertsquad-10.onnx文件和uncased_L-12_H-768_A-12分词文件保存在Resource/文件夹下。下面介绍如何运行python代码示例,Python示例的详细说明见Doc目录下的Tutorial_Python.md。
#### 下载镜像
在光源中下载镜像:
```
python
docker
pull
image
.
sourcefind
.
cn
:
5000
/
dcu
/
admin
/
base
/
custom
:
ort1
.
14.0
_migraphx3
.
0.0
-
dtk22
.
10.1
```
#### 设置Python环境变量
```
export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
```
#### 安装依赖
```
python
# 进入bert ort工程根目录
cd
<
path_to_bert_ort
>
...
...
@@ -40,59 +33,43 @@ cd Python/
# 安装依赖
pip
install
-
r
requirements
.
txt
```
#### 运行示例
```
python
python
bert
.
py
```
输出结果为:
```
“1”:"open-source exascale-class platform for accelerated computing",
"2":"(Tensorflow / PyTorch)",
"3":"scale"
```
输出结果中,问题id对应预测概率值最大的答案。
### 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。
#### 下载镜像
在光源中下载镜像:
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:ort1.14.0_migraphx3.0.0-dtk22.10.1
```
#### 构建工程
```
rbuild build -d depend
```
#### 设置环境变量
将依赖库依赖加入环境变量LD_LIBRARY_PATH,在~/.bashrc中添加如下语句:
```
export LD_LIBRARY_PATH=<path_to_bert_ort>/depend/lib64/:$LD_LIBRARY_PATH
```
然后执行:
```
source ~/.bashrc
source /opt/dtk/env.sh
```
#### 运行示例
```
python
# 进入bert ort工程根目录
cd
<
path_to_bert_ort
>
...
...
@@ -103,9 +80,7 @@ cd build/
# 执行示例程序
.
/
Bert
```
## result
如下所示,在当前界面根据提示输入问题,得到预测答案。
```
question:What is ROCm?
answer:open-source exascale-class platform for accelerated computing
...
...
@@ -114,6 +89,13 @@ answer:tensorflow / pytorch
question:What is ROCm built for?
answer:scale
```
## 应用场景
### 算法类别
参考此分类方法(上传时请去除参考图片):

`此处填算法类别`
### 热点应用行业
应用行业的填写需要做大量调研,从而为使用者提供专业、全面的推荐,除特殊算法,通常推荐数量>=3。
## 源码仓库及问题反馈
...
...
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