Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion delphi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def process_cache(
if run_cfg.explainer_provider == "offline":
llm_client = Offline(
run_cfg.explainer_model,
max_memory=0.9,
max_memory=run_cfg.max_memory,
# Explainer models context length - must be able to accommodate the longest
# set of examples
max_model_len=run_cfg.explainer_model_max_len,
Expand Down
4 changes: 3 additions & 1 deletion delphi/clients/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
destroy_distributed_environment,
destroy_model_parallel,
)
from vllm.inputs import TokensPrompt

from delphi import logger

Expand Down Expand Up @@ -103,6 +104,7 @@ async def process_func(
prompt = self.tokenizer.apply_chat_template(
batch, add_generation_prompt=True, tokenize=True
)
prompt = TokensPrompt(prompt_token_ids=prompt)
prompts.append(prompt)
if self.statistics:
non_cached_tokens = len(
Expand All @@ -121,7 +123,7 @@ async def process_func(
None,
partial(
self.client.generate, # type: ignore
prompt_token_ids=prompts,
prompts,
sampling_params=self.sampling_params,
use_tqdm=False,
),
Expand Down
5 changes: 5 additions & 0 deletions delphi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ class RunConfig(Serializable):
)
"""Number of GPUs to use for explanation and scoring."""

max_memory: float = field(
default=0.9,
)
"""Fraction of GPU memory to allocate to running explainer model."""

seed: int = field(
default=22,
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
"blobfile",
"bitsandbytes",
"flask",
"vllm",
"vllm>=0.10.2",
"aiofiles",
"sentence_transformers",
"anyio>=4.8.0",
Expand Down
Loading