You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用instructor-xl在Weaviate中索引文档遇参数错误,求解决方案

解决方法

1. 升级Weaviate版本

你当前使用的Weaviate 1.19.6版本的text2vec-huggingface模块对hkunlp/instructor-xl模型兼容性不足,旧版本会错误传递该模型不支持的池化参数。

修改Docker-compose文件中的Weaviate镜像版本为至少1.21+的稳定版,示例:

image: semitechnologies/weaviate:1.24.10

2. 调整Schema配置,添加Instructor模型专属Prompt模板

hkunlp/instructor-xl是指令式嵌入模型,必须指定prompt才能生成有效向量,同时新版本Weaviate需要明确配置模型参数。修改Schema中的moduleConfig部分:

"moduleConfig": {
    "text2vec-huggingface": { 
        "skip": False,
        "vectorizePropertyName": False,
        "model": "hkunlp/instructor-xl",
        "modelArguments": {
            # 根据数据场景自定义prompt,示例模板会自动替换字段内容
            "prompt": "Represent the document content for retrieval: {title} {summary} {description}"
        },
        "options": {"waitForModel": True},
    }
}

3. 重启服务并重新执行流程

  1. 停止当前Weaviate服务:docker-compose down
  2. 启动更新后的服务:docker-compose up -d
  3. 重新运行Schema创建脚本,确保新配置生效
  4. 执行索引脚本导入数据

关键说明

  • instructor-xl依赖指令式输入,必须通过modelArguments.prompt指定模板,模板中的{字段名}会自动替换为对应属性的内容
  • 旧版本Weaviate的text2vec-huggingface模块会向模型传递不兼容的pooling_mode_weightedmean_tokens参数,升级后模块会自动适配Instructor模型的参数要求

内容的提问来源于stack exchange,提问作者Audrey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 23:45:29