Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uie cpp deploy #120

Merged
merged 18 commits into from
Aug 24, 2022
Merged

Add uie cpp deploy #120

merged 18 commits into from
Aug 24, 2022

Conversation

joey12300
Copy link
Collaborator

@joey12300 joey12300 commented Aug 16, 2022

PR types

Add Backend

PR changes

Others

Describe

Add uie cpp deploy.

Demo

NER

The result:
赛事名称:
    text: 北京冬奥会自由式滑雪女子大跳台决赛
    probability: 0.850309
    start: 6
    end: 23

时间:
    text: 2月8日上午
    probability: 0.985738
    start: 0
    end: 6

选手:
    text: 谷爱凌
    probability: 0.898155
    start: 28
    end: 31

Relation extraction

The result:
竞赛名称:
    text: 2022语言与智能技术竞赛
    probability: 0.78254
    start: 0
    end: 13
    relation:
        已举办次数:
            text: 4届
            probability: 0.46713
            start: 80
            end: 82

        主办方:
            text: 中国中文信息学会
            probability: 0.842172
            start: 14
            end: 22

            text: 中国计算机学会
            probability: 0.758081
            start: 23
            end: 30

        承办方:
            text: 百度公司
            probability: 0.829271
            start: 35
            end: 39

            text: 中国中文信息学会评测工作委员会
            probability: 0.70005
            start: 40
            end: 55

            text: 中国计算机学会自然语言处理专委会
            probability: 0.619348
            start: 56
            end: 72

Event extraction

The result:
地震触发词:
    text: 地震
    probability: 0.997743
    start: 56
    end: 58
    relation:
        震源深度:
            text: 10千米
            probability: 0.993797
            start: 63
            end: 67

        震中位置:
            text: 云南临沧市凤庆县(北纬24.34度,东经99.98度)
            probability: 0.787402
            start: 23
            end: 50

        地震强度:
            text: 3.5级
            probability: 0.99808
            start: 52
            end: 56

        时间:
            text: 5月16日06时08分
            probability: 0.98533
            start: 11
            end: 22

Opinion extraction

The result:
评价维度:
    text: 店面
    probability: 0.969685
    start: 0
    end: 2
    relation:
        情感倾向[正向,负向]:
            text: 正向
            probability: 0.998215

        观点词:
            text: 干净
            probability: 0.994532
            start: 2
            end: 4


    text: 性价比
    probability: 0.981704
    start: 17
    end: 20
    relation:
        情感倾向[正向,负向]:
            text: 正向
            probability: 0.996614

        观点词:
            text: 高
            probability: 0.957397
            start: 21
            end: 22

Sequence classification

The result:
情感倾向[正向,负向]:
    text: 正向
    probability: 0.999002

Cross task extraction

The result:
法院:
    text: 北京市海淀区人民法院
    probability: 0.922107
    start: 0
    end: 10

被告:
    text: B公司
    probability: 0.843735
    start: 64
    end: 67
    relation:
        委托代理人:
            text: 赵六
            probability: 0.726712
            start: 90
            end: 92


原告:
    text: 张三
    probability: 0.994981
    start: 35
    end: 37
    relation:
        委托代理人:
            text: 李四
            probability: 0.795686
            start: 44
            end: 46

Copy link
Member

@ZeyuChen ZeyuChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples/text/uie/
按模型铺下来即可。
nlp不适合一个场景一类,因为很多是一个预训练模型能支持很多场景

@joey12300 joey12300 marked this pull request as ready for review August 24, 2022 08:15
@joey12300
Copy link
Collaborator Author

examples/text/uie/ 按模型铺下来即可。 nlp不适合一个场景一类,因为很多是一个预训练模型能支持很多场景

Done

@@ -101,6 +101,8 @@ if (ENABLE_TEXT)
find_library(FASTER_TOKENIZER_LIB core_tokenizers ${CMAKE_CURRENT_LIST_DIR}/third_libs/install/faster_tokenizer/lib NO_DEFAULT_PATH)
list(APPEND FASTDEPLOY_LIBS ${FASTER_TOKENIZER_LIB})
list(APPEND FASTDEPLOY_INCS ${CMAKE_CURRENT_LIST_DIR}/third_libs/install/faster_tokenizer/include)
# TODO (zhoushunjie): Will remove it later.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要升级FasterTokenizer的目录结构。

@@ -23,6 +23,7 @@ set(FASTERTOKENIZER_INSTALL_DIR ${THIRD_PARTY_PATH}/install/faster_tokenizer)
set(FASTERTOKENIZER_INC_DIR
"${FASTERTOKENIZER_INSTALL_DIR}/include"
"${FASTERTOKENIZER_INSTALL_DIR}/third_party/include"
"${FASTERTOKENIZER_INSTALL_DIR}/third_party/include/faster_tokenizer" # TODO (zhoushunjie): Will remove it later.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,需要升级

```
#下载SDK,编译模型examples代码(SDK中包含了examples代码)
wget https://bj.bcebos.com/paddlehub/fastdeploy/libs/0.2.0/fastdeploy-linux-x64-gpu-0.2.0.tgz
tar xvf fastdeploy-linux-x64-gpu-0.2.0.tgz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里先改成自行编译吧,下载上面这个,按这个文档也跑不通

UIE目前还未发布,当前需开发者自行编译FastDeploy,通过如下脚本编译得到部署库fastdeploy-linux-x64-dev

git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
mkdir build && cd build
cmake .. -DENABLE_ORT_BACKEND=ON  \
               -DENABLE_VISION=ON \
               -DENABLE_PADDLE_BACKEND=ON \
               -DENABLE_TEXT=ON \
               -DWITH_GPU=ON \
               -DCMAKE_INSTALL_PREFIX=${PWD}/fastdeploy-linux-x64-gpu-dev

make -j8
make install

编译UIE示例代码

cd ../examples/text/uie/cpp
mkdir build && cd build
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/../../../../../build/fastdeploy-linux-x64-gpu-dev
make -j8

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,这里我改改。开始的时候想先占坑,就把vision的一些readme搞过来了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants