ascender1729/pavan/update-worker-count-in-threadpoolexecutor

Update worker calculation in VLLM wrapper
pull/883/head
Pavan Kumar 3 weeks ago committed by GitHub
commit 1250f53678
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -133,12 +133,11 @@ class VLLMWrapper:
Returns: Returns:
List[str]: List of model responses. List[str]: List of model responses.
""" """
# Fetch 95% of the available CPU cores # Calculate the worker count based on 95% of available CPU cores
num_cores = os.cpu_count() num_workers = max(1, int((os.cpu_count() or 1) * 0.95))
num_workers = int(num_cores * 0.95) with concurrent.futures.ThreadPoolExecutor(
with concurrent.futures.ThreadPoolExecutor( max_workers=num_workers
max_workers=num_workers ) as executor:
) as executor:
futures = [ futures = [
executor.submit(self.run, task) for task in tasks executor.submit(self.run, task) for task in tasks
] ]

Loading…
Cancel
Save