diff --git a/docs/user-guides/server.md b/docs/user-guides/server.md index 49220f346..d7c113035 100644 --- a/docs/user-guides/server.md +++ b/docs/user-guides/server.md @@ -169,7 +169,6 @@ For PyTorch & ONNX backend, you can set the following parameters via `with`: | `name` | Model weights, default is `ViT-B/32`. Support all OpenAI released pretrained models. | | `num_worker_preprocess` | The number of CPU workers for image & text prerpocessing, default 4. | | `minibatch_size` | The size of a minibatch for CPU preprocessing and GPU encoding, default 64. Reduce the size of it if you encounter OOM on GPU. | -| `pool_backend` | The backend of the preprocessing worker pool, default is `thread` | There are also runtime-specific parameters listed below: diff --git a/server/clip_server/executors/clip_onnx.py b/server/clip_server/executors/clip_onnx.py index 3aa067a3d..1134e3237 100644 --- a/server/clip_server/executors/clip_onnx.py +++ b/server/clip_server/executors/clip_onnx.py @@ -29,7 +29,6 @@ def __init__( device: Optional[str] = None, num_worker_preprocess: int = 4, minibatch_size: int = 64, - pool_backend: str = 'thread', **kwargs, ): super().__init__(**kwargs) @@ -37,10 +36,8 @@ def __init__( self._preprocess_blob = clip._transform_blob(_SIZE[name]) self._preprocess_tensor = clip._transform_ndarray(_SIZE[name]) - if pool_backend == 'thread': - self._pool = ThreadPool(processes=num_worker_preprocess) - else: - self._pool = Pool(processes=num_worker_preprocess) + self._pool = ThreadPool(processes=num_worker_preprocess) + self._minibatch_size = minibatch_size self._model = CLIPOnnxModel(name) diff --git a/server/clip_server/executors/clip_torch.py b/server/clip_server/executors/clip_torch.py index 50ab7b82c..80d169905 100644 --- a/server/clip_server/executors/clip_torch.py +++ b/server/clip_server/executors/clip_torch.py @@ -1,6 +1,6 @@ import os import numpy as np -from multiprocessing.pool import ThreadPool, Pool +from multiprocessing.pool import ThreadPool from typing import Optional, List, Tuple from jina import Executor, requests, DocumentArray @@ -17,7 +17,6 @@ def __init__( jit: bool = False, num_worker_preprocess: int = 4, minibatch_size: int = 64, - pool_backend: str = 'thread', **kwargs, ): super().__init__(**kwargs) @@ -51,10 +50,7 @@ def __init__( name, device=self._device, jit=jit ) - if pool_backend == 'thread': - self._pool = ThreadPool(processes=num_worker_preprocess) - else: - self._pool = Pool(processes=num_worker_preprocess) + self._pool = ThreadPool(processes=num_worker_preprocess) def _preproc_image(self, da: 'DocumentArray') -> 'DocumentArray': for d in da: