forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Model] Jamba support (vllm-project#4115)
Signed-off-by: Muralidhar Andoorveedu <[email protected]> Co-authored-by: Erez Schwartz <[email protected]> Co-authored-by: Mor Zusman <[email protected]> Co-authored-by: tomeras91 <[email protected]> Co-authored-by: Tomer Asida <[email protected]> Co-authored-by: Zhuohan Li <[email protected]> Co-authored-by: Muralidhar Andoorveedu <[email protected]>
- Loading branch information
1 parent
22fcbe1
commit 15ddc42
Showing
21 changed files
with
1,192 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Mamba dependencies | ||
mamba-ssm>=1.2.2 | ||
causal-conv1d>=1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import pytest | ||
|
||
MODELS = ["ai21labs/Jamba-tiny-random"] | ||
|
||
|
||
@pytest.mark.parametrize("model", MODELS) | ||
@pytest.mark.parametrize("dtype", ["float"]) | ||
@pytest.mark.parametrize("max_tokens", [20]) | ||
def test_models( | ||
hf_runner, | ||
vllm_runner, | ||
example_prompts, | ||
model: str, | ||
dtype: str, | ||
max_tokens: int, | ||
) -> None: | ||
# To pass the small model tests, we need full precision. | ||
assert dtype == "float" | ||
|
||
with hf_runner(model, dtype=dtype) as hf_model: | ||
hf_outputs = hf_model.generate_greedy(example_prompts, max_tokens) | ||
|
||
with vllm_runner(model, dtype=dtype) as vllm_model: | ||
vllm_outputs = vllm_model.generate_greedy(example_prompts, max_tokens) | ||
|
||
for i in range(len(example_prompts)): | ||
hf_output_ids, hf_output_str = hf_outputs[i] | ||
vllm_output_ids, vllm_output_str = vllm_outputs[i] | ||
assert hf_output_str == vllm_output_str, ( | ||
f"Test{i}:\nHF: {hf_output_str!r}\nvLLM: {vllm_output_str!r}") | ||
assert hf_output_ids == vllm_output_ids, ( | ||
f"Test{i}:\nHF: {hf_output_ids}\nvLLM: {vllm_output_ids}") | ||
|
||
|
||
@pytest.mark.parametrize("model", MODELS) | ||
@pytest.mark.parametrize("dtype", ["float"]) | ||
def test_state_cleanup( | ||
vllm_runner, | ||
model: str, | ||
dtype: str, | ||
example_prompts, | ||
) -> None: | ||
# This test is for verifying that the Jamba state is cleaned up between | ||
# steps, If its not cleaned, an error would be expected. | ||
try: | ||
with vllm_runner(model, dtype=dtype) as vllm_model: | ||
for _ in range(10): | ||
vllm_model.generate_greedy([example_prompts[0]] * 100, 1) | ||
except ValueError: | ||
pytest.fail("Jamba inner state wasn't cleaned up between states, " | ||
"could be related to finished_requests_ids") | ||
|
||
|
||
@pytest.mark.parametrize("model", MODELS) | ||
@pytest.mark.parametrize("dtype", ["float"]) | ||
def test_model_print( | ||
vllm_runner, | ||
model: str, | ||
dtype: str, | ||
) -> None: | ||
with vllm_runner(model, dtype=dtype) as vllm_model: | ||
# This test is for verifying whether the model's extra_repr | ||
# can be printed correctly. | ||
print(vllm_model.model.llm_engine.model_executor.driver_worker. | ||
model_runner.model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.