From 1192727be7cde4853e887b64cb24637736c27b33 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 1 Feb 2025 09:53:11 +0800 Subject: [PATCH] remove semaphore logic from EmbeddingFunc(cause num of instances is already control by limit_async_func_call) --- lightrag/utils.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lightrag/utils.py b/lightrag/utils.py index e5b3b8d8..b9308b66 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -60,15 +60,8 @@ class EmbeddingFunc: func: callable concurrent_limit: int = 16 - def __post_init__(self): - if self.concurrent_limit != 0: - self._semaphore = asyncio.Semaphore(self.concurrent_limit) - else: - self._semaphore = UnlimitedSemaphore() - async def __call__(self, *args, **kwargs) -> np.ndarray: - async with self._semaphore: - return await self.func(*args, **kwargs) + return await self.func(*args, **kwargs) def locate_json_string_body_from_string(content: str) -> Union[str, None]: