Skip to content

Add test case for cache #20

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

avery-blanchard
Copy link

@avery-blanchard avery-blanchard commented Apr 8, 2025

This PR adds a test case for caching.

The test case runs twice with a single shape. The caching feature is enabled during the test and disabled after on reset.

cc: @JRosenkranz

Signed-off-by: Avery Blanchard <avery.blanchard@ibm.com>
@@ -287,5 +289,56 @@ def _metric_calculator(r: torch.Tensor, t: torch.Tensor):
else:
print("passed validation level 0")

@pytest.mark.parametrize("model_path,batch_size,seq_length,max_new_tokens,cache_status", cache_params)
def test_cache(model_path, batch_size, seq_length, max_new_tokens, cache_status):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to parametrize everything here other than the miss and hit. Just specify them inside the test.

None,
only_last_token=True,
**padding_kwargs
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there something we need to assert for miss/hit?

Copy link
Contributor

@JRosenkranz JRosenkranz left a comment

Choose a reason for hiding this comment

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

We may want to create a fixture which turns caching on, and caches the compilation. Then in the test we can re-run with caching on/off to make sure we see a hit or no-cache used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants