Skip to content
Closed
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
4 changes: 3 additions & 1 deletion tests/llmcompressor/modeling/test_calib_deepseek_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def test_calib_deepseekv3_module():
# Create dummy input tensor that simulates hidden_states
hidden_dim = config.hidden_size
batch, seq_len = 4, 32

# torch.manual_seed(42)
sample = torch.randn(batch, seq_len, hidden_dim, device="cuda")

with calibration_forward_context(original):
Expand All @@ -78,7 +80,7 @@ def test_calib_deepseekv3_module():
module = CalibrationDeepseekV3MoE(original, config, calibrate_all_experts=True)
with calibration_forward_context(module):
output = module(sample)
assert torch.allclose(true_output, output, atol=1e-6)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Adding an assertion message to torch.allclose calls improves test debuggability by providing context when an assertion fails. This helps in quickly understanding the cause of a test failure.

assert torch.allclose(true_output, output, atol=1e-6), "Samples not close"

assert torch.allclose(true_output, output, atol=1e-6), "Samples not close"

module = CalibrationDeepseekV3MoE(original, config, calibrate_all_experts=False)
with calibration_forward_context(module):
Expand Down
Loading