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
1b2584d3
"vscode:/vscode.git/clone" did not exist on "a41e4c506bea0179ac6e556620c7ed45cc4c5f29"
Commit
1b2584d3
authored
Oct 09, 2023
by
yangql
Browse files
修改readme为model zoo格式
parent
0cc4f3d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
README.md
README.md
+19
-10
No files found.
README.md
View file @
1b2584d3
...
...
@@ -9,14 +9,28 @@
## 算法原理
BERT的全称为Bidirectional Encoder Representation from Transformers,是一个预训练的语言表征模型。它强调了不再像以往一样采用传统的单向语言模型或者把两个单向语言模型进行浅层拼接的方法进行预训练,而是采用新的masked language model(MLM),以致能生成深度的双向语言表征。
## 环境配置
### Docker(方法一)
拉取镜像:
```
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:ort1.14.0_migraphx3.0.0-dtk22.10.1
```
创建并启动容器,安装相关依赖:
```
docker run --shm-size 16g --network=host --name=bert_ort --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $PWD/bert_ort:/home/bert_ort -it <Your Image ID> /bin/bash
# 激活dtk
source /opt/dtk/env.sh
```
## 推理
### 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
...
...
@@ -47,11 +61,6 @@ python bert.py
### 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
...
...
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