Fix: rerank with YoudaoRerank issue. (#6396)

### What problem does this PR solve?

Fix rerank with YoudaoRerank issue,"'YoudaoRerank' object has no
attribute '_dynamic_batch_size'"


![17425412353825](https://github.com/user-attachments/assets/9ed304c7-317a-440e-acff-fe895fc20f07)


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
zhou 2025-03-24 10:09:16 +08:00 committed by GitHub
parent d77380f024
commit a6aed0da46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,6 +194,8 @@ class YoudaoRerank(DefaultRerank):
"maidalun1020", "InfiniFlow"))
self._model = YoudaoRerank._model
self._dynamic_batch_size = 8
self._min_batch_size = 1
def similarity(self, query: str, texts: list):
pairs = [(query, truncate(t, self._model.max_length)) for t in texts]