Vespa多向量索引部署报错:张量类型不支持索引配置
问题描述
部署Vespa多向量索引示例应用时,出现以下错误:
Uploading application package ... failed
Error: invalid application package (400 Bad Request)
Invalid application package:
Error loading default.default:
For schema 'wiki', field 'paragraph_embeddings':
A tensor of type 'tensor(p{},x[384])' does not support having an 'index'.
Currently, only tensors with 1 indexed dimension supports that.
使用环境信息:
- Vespa CLI版本:
Vespa CLI version 8.153.19 compiled with go1.20.3 on darwin/arm64 - Docker总内存:
Total Memory: 7.668GiB
原因分析
当前使用的Vespa版本(8.153.19)不支持多向量索引所需的张量索引配置。旧版本Vespa仅允许张量包含单个索引维度(即仅一个{}类型的维度),而多向量索引依赖的tensor<float>(p{},x[384])包含一个可变维度(p{})和一个固定维度(x[384]),这种多维度索引配置是在较新的Vespa版本中才引入的特性。
解决方案
升级Vespa版本
将Vespa CLI及对应的Docker容器版本升级到支持多向量索引的版本(推荐升级到8.200.0及以上),升级后该张量类型的索引配置可被正确识别。验证应用包配置
升级完成后,确认schema中paragraph_embeddings字段的索引配置符合多向量索引要求,示例配置如下:field paragraph_embeddings type tensor<float>(p{},x[384]) { indexing: attribute | index index: hnsw distance-metric: cosine }
内容的提问来源于stack exchange,提问作者QCoder

