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

jum4pzuy  于 7个月前  发布在  其他
关注(0)|答案(9)|浏览(153)

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

  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]:函数的变量,代码如下:

  1. def _process_request(pipeline, request) -> Dict[str, Any]:
  2. start_time = time.time()
  3. params = request.params or {}
  4. print("params:",params)
  5. print("request.query:",request.query)
  6. # format global, top-level filters (e.g. "params": {"filters": {"name": ["some"]}})
  7. if "filters" in params.keys():
  8. params["filters"] = _format_filters(params["filters"])
  9. # format targeted node filters (e.g. "params": {"Retriever": {"filters": {"value"}}})
  10. for key in params.keys():
  11. if "filters" in params[key].keys():
  12. params[key]["filters"] = _format_filters(params[key]["filters"])
  13. result = pipeline.run(query=request.query, params=params, debug=request.debug)
  14. ......

打印结果:

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

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

展开查看全部
2nc8po8w

2nc8po8w3#

  1. curl [http://localhost:9200/_aliases?pretty=true](http://localhost:9200/_aliases?pretty=true)
  2. 返回的是:
  3. {
  4. "label": {
  5. "aliases": {}
  6. },
  7. "dureader_robust_query_encoder": {
  8. "aliases": {}
  9. }
  10. }
rks48beu

rks48beu4#

有大佬解答吗

r8uurelv

r8uurelv5#

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

yfwxisqw

yfwxisqw6#

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

64jmpszr

64jmpszr7#

  1. version: '1.1.0'
  2. components: # 定义所有Pipeline的构建块
  3. * name: DocumentStore
  4. type: ElasticsearchDocumentStore # 考虑使用Milvus2DocumentStore或WeaviateDocumentStore以扩展到大量文档
  5. params:
  6. host: localhost
  7. port: 9200
  8. index: dureader_robust_base_encoder
  9. embedding_dim: 768
  10. * name: Retriever
  11. type: DensePassageRetriever
  12. params:
  13. document_store: DocumentStore # params可以引用YAML中定义的其他组件
  14. top_k: 10
  15. query_embedding_model: rocketqa-zh-base-query-encoder
  16. passage_embedding_model: rocketqa-zh-base-para-encoder
  17. embed_title: False
  18. * name: Ranker # 为组件自定义名称;有助于可视化和调试
  19. type: ErnieRanker # pipelines组件的类名
  20. params:
  21. model_name_or_path: rocketqa-base-cross-encoder
  22. top_k: 3
  23. * name: TextFileConverter
  24. type: TextConverter
  25. * name: ImageFileConverter
  26. type: ImageToTextConverter
  27. * name: PDFFileConverter
  28. type: PDFToTextConverter
  29. * name: DocxFileConverter
  30. type: DocxToTextConverter
  31. * name: Preprocessor
  32. type: PreProcessor
  33. params:
  34. split_by: word
  35. split_length: 1000
  36. * name: FileTypeClassifier
  37. type: FileTypeClassifier
  38. pipelines:
  39. * name: query
  40. type: Query
  41. nodes:
  42. * name: Retriever
  43. inputs: [Query]
  44. * name: Ranker
  45. inputs: [Retriever]
  46. * name: indexing
  47. type: Indexing
  48. nodes:
  49. * name: FileTypeClassifier
  50. inputs: [File]
  51. * name: TextFileConverter
  52. inputs: [FileTypeClassifier.output_1]
  53. * name: PDFFileConverter
  54. inputs: [FileTypeClassifier.output_2]
  55. * name: DocxFileConverter
  56. inputs: [FileTypeClassifier.output_4]
  57. * name: ImageFileConverter
  58. inputs: [FileTypeClassifier.output_6]
  59. * name: Preprocessor
  60. inputs: [PDFFileConverter, TextFileConverter, DocxFileConverter, ImageFileConverter]
  61. * name: Retriever
  62. inputs: [Preprocessor]
  63. * name: DocumentStore
  64. inputs: [Retriever]
展开查看全部
izkcnapc

izkcnapc9#

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

相关问题