dify bge-reranker-v2-minicpm-layerwise 从 Xinference 挂载错误

ukdjmx9f  于 2个月前  发布在  其他
关注(0)|答案(4)|浏览(37)

自检

  • 仅用于提交错误报告,如果您有问题,请转到 Discussions
  • 我已搜索现有问题 search for existing issues ,包括已关闭的问题。
  • 我确认我使用英语提交此报告(我已阅读并同意 Language Policy )。
  • 请不要修改此模板 :) 并填写所有必填字段。

Dify版本

0.6.6

云或自托管

自托管(Docker)

重现步骤

我想将 bge-reranker-v2-minicpm-layerwise 从 Xinference 挂载到 Dify 如下:

✔️ 预期行为

  • 无响应*

❌ 实际行为

但失败了,docker日志显示:

Exception in thread Thread-1 (embedding_search):
Traceback (most recent call last):
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 35, in invoke
    return self._invoke(model, credentials, query, docs, score_threshold, top_n, user)
  File "/app/api/core/model_runtime/model_providers/xinference/rerank/rerank.py", line 51, in _invoke
    response = handle.rerank(
  File "/usr/local/lib/python3.10/site-packages/xinference_client/client/restful/restful_client.py", line 161, in rerank
    raise RuntimeError(
RuntimeError: Failed to rerank documents, detail: [address=0.0.0.0:56051, pid=1240943] Model not found in the model list, uid: bge-reranker-v2-minicpm-layerwise

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/app/api/core/rag/datasource/retrieval_service.py", line 134, in embedding_search
    all_documents.extend(data_post_processor.invoke(
  File "/app/api/core/rag/data_post_processor/data_post_processor.py", line 22, in invoke
    documents = self.rerank_runner.run(query, documents, score_threshold, top_n, user)
  File "/app/api/core/rerank/rerank.py", line 33, in run
    rerank_result = self.rerank_model_instance.invoke_rerank(
  File "/app/api/core/model_manager.py", line 120, in invoke_rerank
    return self.model_type_instance.invoke(
  File "/app/api/core/model_runtime/model_providers/__base/rerank_model.py", line 37, in invoke
    raise self._transform_invoke_error(e)
core.model_runtime.errors.invoke.InvokeError: [xinference] Error: Failed to rerank documents, detail: [address=0.0.0.0:56051, pid=1240943] Model not found in the model list, uid: bge-reranker-v2-minicpm-layerwise
Building prefix dict from the default dictionary ...
2024-05-14 06:55:52.610 DEBUG [Thread-3 (keyword_search)] [__init__.py:113] - Building prefix dict from the default dictionary ...
Dumping model to file cache /tmp/jieba.cache
2024-05-14 06:55:53.307 DEBUG [Thread-3 (keyword_search)] [__init__.py:146] - Dumping model to file cache /tmp/jieba.cache
Loading model cost 0.784 seconds.
2024-05-14 06:55:53.394 DEBUG [Thread-3 (keyword_search)] [__init__.py:164] - Loading model cost 0.784 seconds.
Prefix dict has been built successfully.
2024-05-14 06:55:53.394 DEBUG [Thread-3 (keyword_search)] [__init__.py:166] - Prefix dict has been built successfully.
/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/model.py:120: SAWarning: This declarative base already contains a class with the same class name and module name as services.app_service.ModifiedApp, and will be replaced in the string-lookup table.
o3imoua4

o3imoua41#

你遇到的错误,即找不到 bge-reranker-v2-minicpm-layerwise 模型,表明存在配置或兼容性问题。以下是解决此问题的聚焦方法:

  1. 检查模型兼容性:确保 bge-reranker-v2-minicpm-layerwise 模型与 ggml 格式兼容,这是 LocalAI 的要求。兼容性详情可以在 LocalAI 文档中找到。

  2. 模型配置:如果兼容,下载并将模型放置在 LocalAI 设置中的正确目录中。然后,更新 LocalAI 配置以包含此模型,指定其外部访问名称和任何所需的设置,这些设置在一个 YAML 文件中。

  3. 重启并更新设置:在 LocalAI 中配置模型后,重新启动示例。在 Dify 中,导航到 Settings > Model Providers > LocalAI 并添加 bge-reranker-v2-minicpm-layerwise 模型及其详细信息。

  4. 测试模型:通过向 LocalAI 端点发出请求来测试集成,确保模型被识别并可用于推理。

如果模型不符合 ggml 兼容性要求或需要在此未涵盖的特定配置,则可能需要进一步的 LocalAI 或模型文档。

详细信息

来源

此响应旨在帮助你节省时间并提供有用的信息。它不是精确的解决方案,而是你自己的研究的起点。
请帮助我变得更有用!如果你觉得这有帮助,请留下一个赞(👍),如果不相关就请留下一个差评(👎)。

  • 要继续对话,请提及 @dosu。*
4xy9mtcn

4xy9mtcn2#

检查模型兼容性:确保 bge-reranker-v2-minicpm-layerwise 模型与 ggml 格式兼容,这是 LocalAI 的要求。兼容性细节可以在 LocalAI 文档中找到。

如何检查这种兼容性?我从 huggingface 下载了模型。

ggazkfy8

ggazkfy83#

要检查Hugging Face上的bge-reranker-v2-minicpm-layerwise模型与LocalAI所需的ggml格式的兼容性,请按照以下步骤操作:

  1. 模型格式和转换:首先,验证模型是否在Hugging Face上以ggml兼容格式可用。如果没有,您可能需要寻找模型作者或社区提供的转换工具或脚本。有时,模型仓库中包含用于将模型转换为不同格式的实用程序脚本。
  2. 与LocalAI集成:在获得兼容版本或转换模型后,继续将其与LocalAI集成。这包括根据LocalAI的文档将模型放置在指定目录中,并在LocalAI的设置中正确配置它。确保您严格遵循部署说明,包括设置任何必要的环境变量并根据需要调整配置文件。
  3. 测试兼容性:在使用LocalAI部署模型后,通过LocalAI的REST API测试其功能。成功的测试表明模型兼容且设置正确。这一步对于确保模型不仅存在于LocalAI中,而且可以按预期运行至关重要。
    如果您在这些步骤中遇到问题,例如模型转换或集成中的错误,建议咨询模型和LocalAI的文档。此外,Hugging Face和LocalAI的社区论坛或支持渠道可以作为解决特定问题或获取有关模型转换和部署策略的建议的宝贵资源。
    请记住,成功集成的关键在于确保模型处于正确的格式、在LocalAI中正确配置以及测试其运行状态。
fv2wmkja

fv2wmkja4#

Seconding this but also @lk1983823 LocalAI has their own Web UX downloader, so could you note down possible ways to get around this? Maybe get FlashRank in on the action?
Also relevant ideas #4377#3779

相关问题