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

[Core][2/N] Model runner refactoring part 2. Combine prepare prefill / decode to a single API #4681

Merged
merged 49 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c9fcb26
first checkpoint done
rkooo567 May 8, 2024
de61dbb
refactoring subquery
rkooo567 May 8, 2024
159ea2f
.
rkooo567 May 8, 2024
5833cbb
ip
rkooo567 May 8, 2024
7614ce0
working
rkooo567 May 8, 2024
6744eff
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 9, 2024
7de7f63
.
rkooo567 May 9, 2024
e8a4ea3
working with flash attn
rkooo567 May 9, 2024
64e8fd4
rocm and sdpa
rkooo567 May 9, 2024
ceec66d
working with flash infer
rkooo567 May 9, 2024
1851d59
add flash infer to pipeline
rkooo567 May 9, 2024
5cf1d3e
.
rkooo567 May 9, 2024
21a612a
working.
rkooo567 May 9, 2024
61dec37
fix spec decoding
rkooo567 May 9, 2024
6cad7bc
Fixed model runner test
rkooo567 May 9, 2024
e20a29e
fixed
rkooo567 May 9, 2024
94964ab
fix intel test
rkooo567 May 9, 2024
ff99251
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 10, 2024
1c77e2d
.
rkooo567 May 10, 2024
f929edd
done
rkooo567 May 10, 2024
74683a1
.
rkooo567 May 10, 2024
546735a
fix circular reference.
rkooo567 May 10, 2024
89e5df2
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 10, 2024
d7b2743
working
rkooo567 May 10, 2024
0ed4160
Merge branch 'circular-dep' into model-runner-refactoring-coelsce
rkooo567 May 10, 2024
f5af730
fixed spec decoding
rkooo567 May 10, 2024
7e39882
working
rkooo567 May 10, 2024
e02bc5d
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 13, 2024
dd48c00
fix embedding meta
rkooo567 May 13, 2024
bba70f1
ip
rkooo567 May 13, 2024
f76b9ea
improve assert
rkooo567 May 13, 2024
cf1dbbb
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 13, 2024
a281d97
done
rkooo567 May 13, 2024
f6afb05
lint
rkooo567 May 13, 2024
35f64ac
done
rkooo567 May 14, 2024
cc5df57
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 14, 2024
ccf937c
.
rkooo567 May 14, 2024
0951715
works except spec decoding
rkooo567 May 14, 2024
2b2423d
.
rkooo567 May 14, 2024
f1c12f3
.,
rkooo567 May 14, 2024
8a01746
.
rkooo567 May 14, 2024
bf7959a
.
rkooo567 May 14, 2024
b42b43d
.
rkooo567 May 14, 2024
e9a973e
ip
rkooo567 May 14, 2024
4e733e2
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 14, 2024
237e939
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 14, 2024
35e98a0
Merge branch 'main' into model-runner-refactoring-coelsce
rkooo567 May 15, 2024
426d99a
.
rkooo567 May 15, 2024
1271556
done
rkooo567 May 15, 2024
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
Prev Previous commit
Next Next commit
.
  • Loading branch information
rkooo567 committed May 14, 2024
commit b42b43d3553743381ad3ead27ac527843b2f9895
88 changes: 44 additions & 44 deletions tests/spec_decode/e2e/test_multistep_correctness.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,50 +253,50 @@ def test_spec_decode_e2e_greedy_correctness_tiny_model_large_bs(
force_output_len=True)


# @pytest.mark.parametrize(
# "common_llm_kwargs",
# [{
# # Skip cuda graph recording for fast test.
# "enforce_eager": True,

# # Required for spec decode.
# "use_v2_block_manager": True
# }])
# @pytest.mark.parametrize(
# "per_test_common_llm_kwargs",
# [
# # Try two different tiny base models.
# # Note that one is equal to the draft model, another isn't.
# {
# "model": "JackFram/llama-68m",
# },
# {
# "model": "JackFram/llama-160m",
# },
# ])
# @pytest.mark.parametrize("baseline_llm_kwargs", [{}])
# @pytest.mark.parametrize("test_llm_kwargs", [
# {
# "speculative_model": "JackFram/llama-68m",
# "num_speculative_tokens": 5,
# },
# ])
# @pytest.mark.parametrize("max_output_len", [
# 256,
# ])
# @pytest.mark.parametrize("batch_size", [32])
# @pytest.mark.parametrize("seed", [1])
# def test_spec_decode_e2e_greedy_correctness_tiny_model_large_bs_diff_output_len(
# baseline_llm_generator, test_llm_generator, batch_size: int,
# max_output_len: int):
# """Verify greedy equality on a tiny model, with a large batch size, and when
# sampling respects the EOS token.
# """
# run_greedy_equality_correctness_test(baseline_llm_generator,
# test_llm_generator,
# batch_size,
# max_output_len,
# force_output_len=False)
@pytest.mark.parametrize(
"common_llm_kwargs",
[{
# Skip cuda graph recording for fast test.
"enforce_eager": True,

# Required for spec decode.
"use_v2_block_manager": True
}])
@pytest.mark.parametrize(
"per_test_common_llm_kwargs",
[
# Try two different tiny base models.
# Note that one is equal to the draft model, another isn't.
{
"model": "JackFram/llama-68m",
},
{
"model": "JackFram/llama-160m",
},
])
@pytest.mark.parametrize("baseline_llm_kwargs", [{}])
@pytest.mark.parametrize("test_llm_kwargs", [
{
"speculative_model": "JackFram/llama-68m",
"num_speculative_tokens": 5,
},
])
@pytest.mark.parametrize("max_output_len", [
256,
])
@pytest.mark.parametrize("batch_size", [32])
@pytest.mark.parametrize("seed", [1])
def test_spec_decode_e2e_greedy_correctness_tiny_model_large_bs_diff_output_len(
baseline_llm_generator, test_llm_generator, batch_size: int,
max_output_len: int):
"""Verify greedy equality on a tiny model, with a large batch size, and when
sampling respects the EOS token.
"""
run_greedy_equality_correctness_test(baseline_llm_generator,
test_llm_generator,
batch_size,
max_output_len,
force_output_len=False)


@pytest.mark.parametrize(
Expand Down
1 change: 1 addition & 0 deletions vllm/attention/backends/flash_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def forward(
# print(f"SANG-TODO {decode_meta.block_tables=}")
# # print(f"SANG-TODO {attn_metadata.slot_mapping=}")
# print(f"SANG-TODO {decode_meta.seq_lens_tensor=}")
# print(f"SANG-TODO decode query: {decode_query=}")
output[num_prefill_tokens:] = flash_attn_with_kvcache(
decode_query.unsqueeze(1),
key_cache,
Expand Down
6 changes: 3 additions & 3 deletions vllm/spec_decode/spec_decode_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ def _run_speculative_decoding_step(
"""

# Generate proposals using draft worker.
# print("SANG-TODO draft")
print("SANG-TODO draft")
proposals = self.proposer_worker.get_spec_proposals(execute_model_req)

# print("SANG-TODO target")
print("SANG-TODO target")
proposal_scores = self.scorer.score_proposals(
execute_model_req,
proposals,
)

# print("SANG-TODO score")
print("SANG-TODO score")
accepted_token_ids, target_logprobs = self._verify_tokens(
execute_model_req.seq_group_metadata_list, proposal_scores,
proposals, execute_model_req.num_lookahead_slots)
Expand Down
1 change: 1 addition & 0 deletions vllm/worker/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ def _prepare_model_input(
slot_mapping_tensor = torch.tensor(slot_mapping,
dtype=torch.long,
device=self.device)
print(f"SANG-TODO {seq_lens_tensor=} {block_tables=}")

if self.attn_backend.get_name() == "flashinfer":
if not hasattr(self, "flashinfer_workspace_buffer"):
Expand Down