[Bug]: FlagReranker' object has no attribute 'max_length'
Is there an existing issue for the same bug?
- [x] I have checked the existing issues.
RAGFlow workspace code commit ID
58a8f1f
RAGFlow image version
infiniflow/ragflow:nightly
Other environment information
OS Type: macOs M4 macmini pro
15.3.1 (24D70)
Actual behavior
in testing screen and also in the actual chat, the error appears.
during "Retrieval Testing" , when selecting a re-ranking model: bge-reranker-v2 the error happens all the time..
During configuration of the chat.. if the same re-ranker model is selected, the error only happens if "reasoning" is disabled, if reasoning is enabled, the error does not appear.
f", "layout_recognize": "DeepDOC", "html4excel": false}, "img2txt_id": "qwen-vl-max@Tongyi-Qianwen", "asr_id": "paraformer-realtime-8k-v1@Tongyi-Qianwen", "llm_id": "qwen-plus@Tongyi-Qianwen", "update_time": 1740486539395, "task_type": ""}} 2025-02-25 20:45:48 2025-02-25 20:45:48,490 ERROR 1091 LLMBundle.encode_queries can't update token usage for 0f0d531ef35111efa89a0242ac120007/EMBEDDING used_tokens: 3 2025-02-25 20:45:48 2025-02-25 20:45:48,549 INFO 1091 POST http://es01:9200/ragflow_0f0d531ef35111efa89a0242ac120007/_search [status:200 duration:0.017s] 2025-02-25 20:45:48 2025-02-25 20:45:48,687 ERROR 1091 'FlagReranker' object has no attribute 'max_length' 2025-02-25 20:45:48 Traceback (most recent call last): 2025-02-25 20:45:48 File "/ragflow/api/apps/chunk_app.py", line 305, in retrieval_test 2025-02-25 20:45:48 ranks = settings.retrievaler.retrieval(question, embd_mdl, tenant_ids, kb_ids, page, size, 2025-02-25 20:45:48 File "<@beartype(rag.nlp.search.Dealer.retrieval) at 0xffff4c327b50>", line 35, in retrieval 2025-02-25 20:45:48 File "/ragflow/rag/nlp/search.py", line 366, in retrieval 2025-02-25 20:45:48 sim, tsim, vsim = self.rerank_by_model(rerank_mdl, 2025-02-25 20:45:48 File "<@beartype(rag.nlp.search.Dealer.rerank_by_model) at 0xffff4c327a30>", line 35, in rerank_by_model 2025-02-25 20:45:48 File "/ragflow/rag/nlp/search.py", line 327, in rerank_by_model 2025-02-25 20:45:48 vtsim, _ = rerank_mdl.similarity(query, [rmSpace(" ".join(tks)) for tks in ins_tw]) 2025-02-25 20:45:48 File "<@beartype(api.db.services.llm_service.LLMBundle.similarity) at 0xffff39f28ca0>", line 50, in similarity 2025-02-25 20:45:48 File "/ragflow/api/db/services/llm_service.py", line 256, in similarity 2025-02-25 20:45:48 sim, used_tokens = self.mdl.similarity(query, texts) 2025-02-25 20:45:48 File "<@beartype(rag.llm.rerank_model.DefaultRerank.similarity) at 0xffff3a9d6290>", line 50, in similarity 2025-02-25 20:45:48 File "/ragflow/rag/llm/rerank_model.py", line 148, in similarity 2025-02-25 20:45:48 res = self._process_batch(pairs, max_batch_size=batch_size) 2025-02-25 20:45:48 File "/ragflow/rag/llm/rerank_model.py", line 115, in _process_batch 2025-02-25 20:45:48 batch_scores = self._compute_batch_scores(pairs[i:i+current_batch]) 2025-02-25 20:45:48 File "/ragflow/rag/llm/rerank_model.py", line 137, in _compute_batch_scores 2025-02-25 20:45:48 max_length = self._model.max_length 2025-02-25 20:45:48 AttributeError: 'FlagReranker' object has no attribute 'max_length' 2025-02-25 20:45:48 2025-02-25 20:45:48,688 INFO 1091 172.18.0.6 - - [25/Feb/2025 20:45:48] "POST /v1/chunk/retrieval_test HTTP/1.1" 200 -
Expected behavior
I expect selecting a re-ranking model to work.
Steps to reproduce
create a knowledge base.
go to "Retrieval testing" page.
select BGE-reranker-v2-m3 .
type in the words you want to retrieve and hit "testing" button.
Additional information
Different error happens with v1 model in the chat configuration .. ie: both re-ranker models produce different errors.