make it lighten (#2577)

### What problem does this PR solve?

#2295

### Type of change

- [x] Refactoring
This commit is contained in:
Kevin Hu
2024-09-25 13:38:40 +08:00
committed by GitHub
parent e4c9cf2264
commit dda1367ab2
4 changed files with 13 additions and 12 deletions

View File

@@ -109,8 +109,8 @@ class YoudaoRerank(DefaultRerank):
_model_lock = threading.Lock()
def __init__(self, key=None, model_name="maidalun1020/bce-reranker-base_v1", **kwargs):
from BCEmbedding import RerankerModel
if not YoudaoRerank._model:
if not LIGHTEN and not YoudaoRerank._model:
from BCEmbedding import RerankerModel
with YoudaoRerank._model_lock:
if not YoudaoRerank._model:
try: