-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[LLM-IE] Add qwen2 to Taskflow #9681
base: develop
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9681 +/- ##
===========================================
- Coverage 52.85% 52.31% -0.55%
===========================================
Files 676 720 +44
Lines 107827 113349 +5522
===========================================
+ Hits 56990 59293 +2303
- Misses 50837 54056 +3219 ☔ View full report in Codecov by Sentry. |
paddlenlp/taskflow/taskflow.py
Outdated
@@ -314,6 +314,17 @@ | |||
}, | |||
"information_extraction": { | |||
"models": { | |||
"llama": {"task_class": QwenIETask, "hidden_size": 768, "task_flag": "information_extraction-llama"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有Llama吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有,这个是我当时测试的,可以删了
paddlenlp/taskflow/taskflow.py
Outdated
"llama": {"task_class": QwenIETask, "hidden_size": 768, "task_flag": "information_extraction-llama"}, | ||
"qwen-1.5b": { | ||
"task_class": QwenIETask, | ||
"hidden_size": 768, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些 hidden_size 不对吧 @wawltor zeyang看一下,这个 hidden_size 参数有用不?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个hidden_size参数不需要用到
paddlenlp/taskflow/taskflow.py
Outdated
@@ -314,6 +314,17 @@ | |||
}, | |||
"information_extraction": { | |||
"models": { | |||
"llama": {"task_class": QwenIETask, "hidden_size": 768, "task_flag": "information_extraction-llama"}, | |||
"qwen-1.5b": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看看名字要不要换,ie-qwen-1.5b
或者其他 @wawltor
@@ -1,252 +0,0 @@ | |||
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件是不需要了吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对的
self._temperature = kwargs.get("temperature", 1.0) | ||
self._decode_strategy = kwargs.get("decode_strategy", "sampling") | ||
self._num_return_sequences = kwargs.get("num_return_sequences", 1) | ||
self.prompt = """你是一个阅读理解专家,请提取所给句子与问题,提取实体。请注意,如果存在实体,则一定在原句中逐字出现,请输出对应实体的原文,不要进行额外修改;如果无法提取,请输出“无相应实体”。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
写成全局变量,大写。放在类定义的外面。
QWEN_IE_PROMPT = """"xxx"""
result_list = self._single_stage_predict(examples) | ||
print('after single stage predict:',result_list) | ||
|
||
if not node.parent_relations: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里走的是哪一个分支?还是 parent_relations
两个分支都有可能走到?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
两个分支都可能走到
llm/ie/README.md
Outdated
@@ -0,0 +1,381 @@ | |||
# 通用信息抽取 UIE(Universal Information Extraction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 通用信息抽取 UIE(Universal Information Extraction) | |
# 大模型信息抽取 LLM-IE(Large Language Model Information Extraction) |
llm/ie/README.md
Outdated
| `uie-base` (默认)| 12-layers, 768-hidden, 12-heads | 中文 | | ||
| `uie-base-en` | 12-layers, 768-hidden, 12-heads | 英文 | | ||
| `uie-medical-base` | 12-layers, 768-hidden, 12-heads | 中文 | | ||
| `uie-medium`| 6-layers, 768-hidden, 12-heads | 中文 | | ||
| `uie-mini`| 6-layers, 384-hidden, 12-heads | 中文 | | ||
| `uie-micro`| 4-layers, 384-hidden, 12-heads | 中文 | | ||
| `uie-nano`| 4-layers, 312-hidden, 12-heads | 中文 | | ||
| `uie-m-large`| 24-layers, 1024-hidden, 16-heads | 中、英文 | | ||
| `uie-m-base`| 12-layers, 768-hidden, 12-heads | 中、英文 | --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换成qwen
llm/ie/README.md
Outdated
``` | ||
|
||
* `schema`:定义任务抽取目标,可参考开箱即用中不同任务的调用示例进行配置。 | ||
* `schema_lang`:设置 schema 的语言,默认为`zh`, 可选有`zh`和`en`。因为中英 schema 的构造有所不同,因此需要指定 schema 的语言。该参数只对`uie-m-base`和`uie-m-large`模型有效。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还没吃吃的先删除吧、
llm/ie/README.md
Outdated
* `schema_lang`:设置 schema 的语言,默认为`zh`, 可选有`zh`和`en`。因为中英 schema 的构造有所不同,因此需要指定 schema 的语言。该参数只对`uie-m-base`和`uie-m-large`模型有效。 | ||
* `batch_size`:批处理大小,请结合机器情况进行调整,默认为1。 | ||
* `model`:选择任务使用的模型,默认为`qwen-0.5b`,可选有`qwen-0.5b`, `qwen-1.5b`。 | ||
* `precision`:选择模型精度,默认为`fp32`,可选有`fp16`和`fp32`。`fp16`推理速度更快,支持 GPU 和 NPU 硬件环境。如果选择`fp16`,在 GPU 硬件环境下,请先确保机器正确安装 NVIDIA 相关驱动和基础软件,**确保 CUDA>=11.2,cuDNN>=8.1.1**,初次使用需按照提示安装相关依赖。其次,需要确保 GPU 设备的 CUDA 计算能力(CUDA Compute Capability)大于7.0,典型的设备包括 V100、T4、A10、A100、GTX 20系列和30系列显卡等。更多关于 CUDA Compute Capability 和精度支持情况请参考 NVIDIA 文档:[GPU 硬件与支持精度对照表](https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-840-ea/support-matrix/index.html#hardware-precision-matrix)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bf16 支持
PR types
New features
PR changes
APIs
Description
add qwen2 to Taskflow