-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 text semantic matching for taskflow #3003
Conversation
docs/model_zoo/taskflow.md
Outdated
@@ -1324,6 +1325,32 @@ from paddlenlp import Taskflow | |||
* `output_scores`:是否要输出解码得分,请默认为False。 | |||
</div></details> | |||
|
|||
### 文本语义相似度 |
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.
这里是否可以和已有的文本相似度任务合并,通过Taskflow("text_similarity", model="XXX")
选择不同的backbone
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
"models": { | ||
"rocketqa-zh-dureader-cross-encoder": { | ||
"task_class": SemanticMatchingTask, | ||
"task_flag": 'semantic_matching-cross-encoder', |
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.
task_flag
的模型名称建议和model
对齐
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
"rocketqa-zh-dureader-cross-encoder": { | ||
"task_class": TextSimilarityTask, | ||
"task_flag": 'rocketqa-zh-dureader-cross-encoder', | ||
}, | ||
}, | ||
"default": { | ||
"model": "simbert-base-chinese" |
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.
默认模型这里可以改为rocketqa-zh-dureader-cross-encoder
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
@@ -192,6 +192,10 @@ | |||
"task_class": TextSimilarityTask, | |||
"task_flag": "text_similarity-simbert-base-chinese" | |||
}, | |||
"rocketqa-zh-dureader-cross-encoder": { | |||
"task_class": TextSimilarityTask, | |||
"task_flag": 'rocketqa-zh-dureader-cross-encoder', |
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.
'rocketqa-zh-dureader-cross-encoder' -> 'text_similarity-rocketqa-zh-dureader-cross-encoder'
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.
已修改
docs/model_zoo/taskflow.md
Outdated
|
||
#### 单条输入 | ||
|
||
```python | ||
>>> from paddlenlp import Taskflow | ||
>>> similarity = Taskflow("text_similarity") | ||
>>> similarity = Taskflow("text_similarity",model="rocketqa-zh-dureader-cross-encoder") |
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.
建议默认调用不加model参数进行简化,直接similarity = Taskflow("text_similarity")
,然后参考UIE提供一个模型选择的表格
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.
Leave a comment
if ('rocketqa' not in model): | ||
self._check_task_files() | ||
self._get_inference_model() | ||
else: | ||
self._construct_model(model) |
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.
为什么 RocketQA cross encoder 模型不支持走动转静之后的高性能预测?
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.
LGTM
PR types
PR changes
Description