---
title: nlp_faq-question-answering_multilingual-base
canonical_url: "https://www.modelscope.cn/models/damo/nlp_faq-question-answering_multilingual-base"
md_url: "https://www.modelscope.cn/models/damo/nlp_faq-question-answering_multilingual-base.md"
repository: damo/nlp_faq-question-answering_multilingual-base
chinese_name: "FAQ问答-多语言-通用领域-base"
last_updated: 2023-03-13
license: "Apache License 2.0"
pipeline_tag: faq-question-answering
tasks:
  - faq-question-answering
  - sentence-similarity
  - sentence-embedding
architectures:
  - XLMRobertaForMaskedLM
library_name:
  - pytorch
frameworks:
  - pytorch
language:
  - multilingual
domain:
  - nlp
downloads: 722
stars: 7
---

# nlp_faq-question-answering_multilingual-base

> nlp_faq-question-answering_multilingual-base - damo 在 ModelScope 开源的模型。多语言FAQ问答模型基于多语言预训练模型为底座，设计FAQ原型网络，并通过百万级多语言问答数据进行微调，支持英、俄、西、法、阿、越南、泰语、粤语等语言的排序任务，对输入的用户问题和候选集，进行知识粒度的排序和定位。

damo/nlp_faq-question-answering_multilingual-base 是 ModelScope 魔搭社区上的faq-question-answering、sentence-similarity、sentence-embedding模型，采用 Apache License 2.0 许可。

- **Repository**: damo/nlp_faq-question-answering_multilingual-base
- **License**: Apache License 2.0
- **Tasks**: faq-question-answering, sentence-similarity, sentence-embedding
- **Downloads**: 722
- **Stars**: 7
- **Last updated**: 2023-03-13

Source: https://www.modelscope.cn/models/damo/nlp_faq-question-answering_multilingual-base

---

# FAQ问答模型

FAQ问答是对话系统中最常见的业务场景，利用FAQ问答模型计算用户问题与知识库问法间的相似度并进行排序，从而定位用户意图并返回合适的答案。多语言FAQ问答模型支持多种语言的语义排序任务。

## 模型描述

多语言FAQ问答模型基于多语言预训练模型为底座，设计FAQ原型网络，并通过百万级多语言问答数据进行微调，支持英、俄、西、法、阿、越南、泰语、粤语等语言的排序任务，对输入的用户问题和候选集，进行知识粒度的排序和定位。

语言支持：英、俄、西、法、阿、韩、葡、越南、泰语、印尼语、菲律宾语、马来语、粤语

## 期望模型使用方式及适用范围

### 如何使用

在安装完成ModelScope之后即可使用nlp_faq-question-answering_multilingual-base的FAQ问答能力


#### 代码范例

```python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

# query_set: query
# support_set: faq候选列表，一般实际应用场景中通过检索得到
pipeline = pipeline(Tasks.faq_question_answering, 'damo/nlp_faq-question-answering_multilingual-base')
outputs = pipeline({"query_set": ['如何使用优惠券', '在哪里领券', '购物评级怎么看'],
                   "support_set": [{'text': '卖品代金券怎么用', 'label': '2931733'}, 
                                   {'text': '怎么使用优惠券', 'label': '2931733'}, 
                                   {'text': '这个可以一起领吗', 'label': '3626004'}, 
                                   {'text': '付款时送的优惠券哪里领', 'label': '3626004'}, 
                                   {'text': '购物等级怎么长', 'label': '6344909'}, 
                                   {'text': '购物等级二心', 'label': '6344909'}]})
# 如果输入数据中每个label只有一个句子，则可以做句子相似度计算任务

# outputs
# 输出每一个类的分值，并进行排序
# {'output': 
# [[{'label': '2931733', 'score': 0.9994094371795654}, {'label': '3626004', 'score': 0.6613603830337524}, {'label': '6344909', 'score': 0.012316078878939152}], 
# [{'label': '3626004', 'score': 0.9557718634605408}, {'label': '2931733', 'score': 0.6888431310653687}, {'label': '6344909', 'score': 0.015988143160939217}], 
# [{'label': '6344909', 'score': 0.988781750202179}, {'label': '2931733', 'score': 0.040523186326026917}, {'label': '3626004', 'score': 0.035687271505594254}]]}
```
备注：我们不限定query_set 和 support_set大小，使用者需要基于基于显存大小以及对性能的要求输入合适大小的候选集；
