Skip to content

Instantly share code, notes, and snippets.

@ZmeiGorynych
ZmeiGorynych / parallel.py
Created September 16, 2024 14:21
A threading approach to concurrently calling IO-blocked functions such as LLMs
from typing import Callable, Iterable
import logging
import concurrent.futures
logger = logging.getLogger(__name__)
def process_batch_parallel(
function: Callable,
batched_args: Iterable,