Find me bugs in this repo
- User
Find me bugs in this repo
- Assistant
Here are some potential issues in the repository based on a review of the provided files:
1.
test_compression_rate_1Assertion Error RiskFile:
./repos/kvpress/tests/test_per_layer_compression_wrapper.pypyassert past_key_values.key_cache[0].shape == torch.Size([5, 2, 230, 6]) assert past_key_values.key_cache[1].shape == torch.Size([5, 2, 0, 6])Problem:
The test assumes that thekey_cacheshapes will match specific sizes, but this hardcoding creates brittleness:- Variations in inputs, model configurations, or architecture changes could break this test.
- If
compression_ratios = [0.1, 1]are applied inconsistently across layers, the test will fail unexpectedly.
Fix Suggestion:
Make assertions dynamic by calculating the expected shapes based on the input andcompression_ratios. For example:pyexpected_shapes = [ torch.Size([batch_size, num_heads, seq_len * ratio, hidden_dim]) for ratio in compression_ratios ] for idx, expected_shape in enumerate(expected_shapes): assert past_key_values.key_cache[idx].shape == expected_shape
2.
test_pipeline_answer_is_correctHardcoded AnswerFile:
./repos/kvpress/tests/test_pipeline.pypyassert answer == "This article was written on January 1, 2022."Problem:
This test expects a specific output from thedanube_500m_model, which may not hold across different models or configurations. If the model's weights or tokenizer change, this test will break.Fix Suggestion:
Test for semantic equivalence rather than exact string matches. For example:pyassert "January 1, 2022" in answerAlternatively, use a more robust evaluation method like BLEU or ROUGE scores.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.