Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Make chunekd prefill work with lora #4994

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions vllm/engine/llm_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,10 @@ def _get_stats(

for idx, scheduled_seq_group in enumerate(
scheduler_outputs.scheduled_seq_groups):
# print(f"SANG-TODO {scheduler_outputs.num_prefill_groups=}")
group_was_prefill = idx < scheduler_outputs.num_prefill_groups
# print(f"SANG-TODO {group_was_prefill=}")
# print(f"SANG-TODO {idx=}")
seq_group = scheduled_seq_group.seq_group

# NOTE: a seq_group that completed all of its prefill tokens
Expand Down
1 change: 1 addition & 0 deletions vllm/lora/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ def _get_logits(
nan=float("-inf"),
posinf=float("inf"),
neginf=float("-inf")))
# print(f"SANG-TODO { logits[:,self.base_layer.org_vocab_size:self.base_layer.org_vocab_size + lora_logits.shape[1]].shape=} {lora_logits.shape=} {self.indices_padded[:self.indices_len[2]]=} {hidden_states.shape=}")
logits[:,
self.base_layer.org_vocab_size:self.base_layer.org_vocab_size +
lora_logits.shape[1]] = lora_logits
Expand Down
1 change: 1 addition & 0 deletions vllm/lora/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def convert_mapping(
if long_lora_indices_len is not None:
indices_len.append(long_lora_indices_len)

# print(f"{mapping.prompt_mapping=} {sampler_indices=} {sampler_indices_padded=} {indices_len=}")
return (base_indices, sampler_indices, sampler_indices_padded,
embeddings_indices, long_lora_indices, indices_len)

Expand Down
20 changes: 14 additions & 6 deletions vllm/worker/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,19 @@ def _prepare_model_input(
lora_requests.add(seq_group_metadata.lora_request)

lora_index_mapping += [lora_id] * (seq_len - context_len)
lora_prompt_mapping.extend(
[lora_id] *
(seq_len -
context_len if seq_group_metadata.sampling_params
and seq_group_metadata.sampling_params.prompt_logprobs
else 1))
if (seq_group_metadata.sampling_params
and seq_group_metadata.sampling_params.prompt_logprobs):
lora_prompt_mapping.extend([lora_id] * (seq_len - context_len))
else:
if seq_group_metadata.do_sample:
lora_prompt_mapping.append(lora_id)
# lora_prompt_mapping.extend(
# [lora_id] *
# (seq_len -
# context_len if seq_group_metadata.sampling_params
# and seq_group_metadata.sampling_params.prompt_logprobs
# else 1))
# print(f"{len(lora_prompt_mapping)=}")

if seq_group_metadata.multi_modal_data:
multi_modal_input_list.append(
Expand Down Expand Up @@ -675,6 +682,7 @@ def execute_model(
(input_tokens, input_positions, attn_metadata, sampling_metadata,
lora_requests, lora_mapping, multi_modal_input
) = self.prepare_input_tensors(seq_group_metadata_list)
# print(f"{input_tokens.shape=}")

if self.lora_config:
self.set_active_loras(lora_requests, lora_mapping)
Expand Down
Loading