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
24 changes: 18 additions & 6 deletions delphi/clients/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,28 @@ async def process_func(
Process a single request.
"""

# This is actually stupid
# Extract params from kwargs - must pass to constructor, not mutate after,
# because SamplingParams.__post_init__ likely does some extra setup,
# and mutation after construction skips this.
logprobs = None
prompt_logprobs = None
max_tokens = self.sampling_params.max_tokens
temperature = 1.0
Comment on lines +92 to +95
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if these should default to the default values in the definition of SamplingParams, or default to self.sampling_params's most recent values

for kwarg in kwargs:
if "logprobs" in kwarg:
self.sampling_params.logprobs = kwarg["top_logprobs"]
logprobs = kwarg["top_logprobs"]
if "prompt_logprobs" in kwarg:
self.sampling_params.prompt_logprobs = kwarg["prompt_logprobs"]
prompt_logprobs = kwarg["prompt_logprobs"]
if "max_tokens" in kwarg:
self.sampling_params.max_tokens = kwarg["max_tokens"]
max_tokens = kwarg["max_tokens"]
if "temperature" in kwarg:
self.sampling_params.temperature = kwarg["temperature"]
temperature = kwarg["temperature"]
sampling_params = SamplingParams(
max_tokens=max_tokens,
logprobs=logprobs,
prompt_logprobs=prompt_logprobs,
temperature=temperature,
)
loop = asyncio.get_running_loop()
prompts = []
statistics = []
Expand Down Expand Up @@ -124,7 +136,7 @@ async def process_func(
partial(
self.client.generate, # type: ignore
prompts,
sampling_params=self.sampling_params,
sampling_params=sampling_params, # Use fresh sampling_params
use_tqdm=False,
),
)
Expand Down