fix: jina-colbert-v2 reranker fails to load and turns hybrid search off (#31532)

Choosing jinaai/jina-colbert-v2 as the reranking model failed on the current transformers release with "'HF_ColBERT' object has no attribute 'all_tied_weights_keys'", and saving the Documents settings quietly switched hybrid search back off. The ColBERT reranker now finishes loading, reranks search results and hybrid search stays on after saving.

Fixes #31522
This commit is contained in:
Classic298 2026-09-30 17:34:20 +02:00 • committed by GitHub
parent e5b57540f6
commit bee06b08ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,12 +4,29 @@ import os
import numpy as np
import torch
from colbert.infra import ColBERTConfig
from colbert.modeling import base_colbert, hf_colbert
from colbert.modeling.checkpoint import Checkpoint
from open_webui.retrieval.models.base_reranker import BaseReranker
from transformers import PretrainedConfig
log = logging.getLogger(__name__)
def class_factory(name_or_path: str) -> type:
hf_colbert_class = hf_colbert.class_factory(name_or_path)
# colbert-ai never calls post_init, which transformers 5 needs to finish setting up the model
class HF_ColBERT(hf_colbert_class):
def __init__(self, config: PretrainedConfig, colbert_config: ColBERTConfig) -> None:
super().__init__(config, colbert_config)
self.post_init()
return HF_ColBERT
base_colbert.class_factory = class_factory
class ColBERT(BaseReranker):
def __init__(self, name, **kwargs) -> None:
log.info('ColBERT: Loading model %s', name)