PaddleNLP [问题]:部署语义检索系统后端报错:search_phase_execution_exception

jum4pzuy  于 22天前  发布在  其他
关注(0)|答案(9)|浏览(16)

请尝试以下步骤解决问题:

  1. 确保您的 Elasticsearch 服务正在运行,并且可以正常访问。您可以通过访问 http://localhost:9200 来测试连接。

  2. 检查您的 Elasticsearch 配置文件(通常是 elasticsearch.yml),确保 http.port 设置为正确的端口(默认为 9200)。

  3. 检查您的前端代码中的 Elasticsearch 索引名称是否正确。在您提供的 JSON 数据中,索引名称为 dureader_robust_query_encoder,请确保这是正确的索引名称。

  4. 如果问题仍然存在,请查看 Elasticsearch 的日志文件(通常位于 logs 目录下),以获取更多关于错误的详细信息。这将有助于您更好地了解问题所在。
    这是一个Python程序的错误日志,它描述了一个在运行PaddlePaddle框架时发生的异常。具体来说,这个异常发生在一个名为search.py的文件中,该文件位于rest_api/controller目录下。异常类型为RequestError,状态码为400,错误信息为search_phase_execution_exception,提示为runtime error

要解决这个问题,你需要检查search.py文件中的相关代码,特别是与Elasticsearch查询相关的部分。可能的原因包括查询语句错误、索引不存在或Elasticsearch客户端配置不正确等。请仔细检查这些部分并进行相应的修复。

iyr7buue

iyr7buue1#

curl -X POST -k http://localhost:8891/query -H 'Content-Type: application/json' -d '{"query":"衡量酒水的价格的因素有哪些?","params": {"Retriever": {"top_k": 5}, "Ranker":{"top_k": 5}}}' 输入这个命令请求后端也是报同样错误

qnyhuwrf

qnyhuwrf2#

启动好restapi和webui之后,出现了一个错误。测试过程如下:

问句是:“衡量酒水的价格的因素有哪些?”

打印了PaddleNLP-develop\pipelines\rest_api\controller\search.pydef _process_request(pipeline, request) -> Dict[str, Any]:函数的变量,代码如下:

def _process_request(pipeline, request) -> Dict[str, Any]:
    start_time = time.time()
    params = request.params or {}
    print("params:",params)
    print("request.query:",request.query)
    # format global, top-level filters (e.g. "params": {"filters": {"name": ["some"]}})
    if "filters" in params.keys():
        params["filters"] = _format_filters(params["filters"])
    # format targeted node filters (e.g. "params": {"Retriever": {"filters": {"value"}}})
    for key in params.keys():
        if "filters" in params[key].keys():
            params[key]["filters"] = _format_filters(params[key]["filters"])
    result = pipeline.run(query=request.query, params=params, debug=request.debug)
    ......

打印结果:

params: {'filters': {}, 'Retriever': {'top_k': 30}, 'Ranker': {'top_k': 3}}
request.query: 衡量酒水的价格的因素有哪些?
'filters'是空的字典{}
result = pipeline.run(query=request.query, params=params, debug=request.debug)

这个命令报错了,如上面的“elasticsearch.exceptions.RequestError: RequestError(400, 'search_phase_execution_exception', 'runtime error')”。

2nc8po8w

2nc8po8w3#

curl [http://localhost:9200/_aliases?pretty=true](http://localhost:9200/_aliases?pretty=true)
返回的是:
{
 "label": {
 "aliases": {}
 },
 "dureader_robust_query_encoder": {
 "aliases": {}
 }
}
r8uurelv

r8uurelv5#

遇到相同的问题,不知道老兄是否已经解决了。

yfwxisqw

yfwxisqw6#

semantic_search.yaml配置文件能发出来看下吗,可能配置的不对。

64jmpszr

64jmpszr7#

version: '1.1.0'
components: # 定义所有Pipeline的构建块

* name: DocumentStore

  type: ElasticsearchDocumentStore # 考虑使用Milvus2DocumentStore或WeaviateDocumentStore以扩展到大量文档
  params:
    host: localhost
    port: 9200
    index: dureader_robust_base_encoder
    embedding_dim: 768

* name: Retriever

  type: DensePassageRetriever
  params:
    document_store: DocumentStore # params可以引用YAML中定义的其他组件
    top_k: 10
    query_embedding_model: rocketqa-zh-base-query-encoder
    passage_embedding_model: rocketqa-zh-base-para-encoder
    embed_title: False

* name: Ranker # 为组件自定义名称;有助于可视化和调试

  type: ErnieRanker # pipelines组件的类名
  params:
    model_name_or_path: rocketqa-base-cross-encoder
    top_k: 3

* name: TextFileConverter

  type: TextConverter

* name: ImageFileConverter

  type: ImageToTextConverter

* name: PDFFileConverter

  type: PDFToTextConverter

* name: DocxFileConverter

  type: DocxToTextConverter

* name: Preprocessor

  type: PreProcessor
  params:
    split_by: word
    split_length: 1000

* name: FileTypeClassifier

  type: FileTypeClassifier
pipelines:

* name: query

  type: Query
  nodes:

* name: Retriever

  inputs: [Query]

* name: Ranker

  inputs: [Retriever]

* name: indexing

  type: Indexing
  nodes:

* name: FileTypeClassifier

  inputs: [File]

* name: TextFileConverter

  inputs: [FileTypeClassifier.output_1]

* name: PDFFileConverter

  inputs: [FileTypeClassifier.output_2]

* name: DocxFileConverter

  inputs: [FileTypeClassifier.output_4]

* name: ImageFileConverter

  inputs: [FileTypeClassifier.output_6]

* name: Preprocessor

  inputs: [PDFFileConverter, TextFileConverter, DocxFileConverter, ImageFileConverter]

* name: Retriever

  inputs: [Preprocessor]

* name: DocumentStore

  inputs: [Retriever]
izkcnapc

izkcnapc9#

遇到相同的问题,希望有大佬帮忙看看,困扰好几天了,难受。

相关问题