Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lighteval/models/endpoints/litellm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from concurrent.futures import ThreadPoolExecutor
from json import JSONDecodeError

import httpx
import requests
from tqdm import tqdm

Expand Down Expand Up @@ -158,6 +159,16 @@ def __init__(self, config: LiteLLMModelConfig) -> None:
self.pairwise_tokenization = False
litellm.drop_params = True
litellm.verbose = config.verbose

# Configure litellm's global HTTP client to match concurrent_requests,
# avoiding the default httpx connection pool limit of 100.
litellm.client_session = httpx.Client(
limits=httpx.Limits(
max_connections=config.concurrent_requests,
max_keepalive_connections=config.concurrent_requests,
),
timeout=httpx.Timeout(config.timeout) if config.timeout else httpx.Timeout(None),
)
self.prompt_manager = PromptManager(
use_chat_template=True, tokenizer=self.tokenizer, system_prompt=config.system_prompt
)
Expand Down