Skip to content

test: per_sample mode and disable_adapters coverage for kl.py - #30

Closed
hai-pilgrim wants to merge 1 commit into
marksverdhei:mainfrom
hai-pilgrim:test/kl-extra-coverage
Closed

hai-pilgrim wants to merge 1 commit into
marksverdhei:mainfrom
hai-pilgrim:test/kl-extra-coverage

Conversation

@hai-pilgrim

Copy link
Copy Markdown

Summary

  • Covers the two untested paths in bakery/kl.py: compute_kl_divergence(per_sample=True) and the disable_adapters context manager
  • per_sample tests: tensor shape, near-zero for identical distributions, scalar/mean equivalence, variable mask lengths, empty mask (clamp safety), temperature scaling
  • disable_adapters tests: normal enable/disable sequence, exception recovery (adapter re-enabled after crash), yield value is None

Test plan

  • 9 tests, all passing: uv run pytest tests/test_kl_extra.py -q

🤖 Generated with Claude Code

Tests per_sample=True tensor shape, zero values for identical distributions,
scalar/per-sample relationship, variable mask lengths, empty mask (clamp
safety), and temperature scaling. Tests disable_adapters for normal flow,
exception recovery, and yield value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marksverdhei

Copy link
Copy Markdown
Owner

Closing — superseded by #24 (already merged). Also: import pytest at the bottom of the file is a bug.

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