Skip to content

fix: add helpful error messages to asserts#188

Open
tykoo-chen wants to merge 1 commit intokarpathy:masterfrom
tykoo-chen:fix/assert-messages
Open

fix: add helpful error messages to asserts#188
tykoo-chen wants to merge 1 commit intokarpathy:masterfrom
tykoo-chen:fix/assert-messages

Conversation

@tykoo-chen
Copy link

Problem

When assertions fail, users see generic AssertionError without context, making debugging harder. For example:

AssertionError

Solution

Add descriptive error messages to key assertions:

  • TOTAL_BATCH_SIZE check: Shows actual values when divisibility fails
  • WINDOW_PATTERN check: Shows the invalid pattern

Example

Before:

AssertionError

After:

AssertionError: TOTAL_BATCH_SIZE (524288) must be divisible by tokens_per_fwdbwd (262144)

Small change, better debugging experience.

When assertions fail, users get more context about what went wrong:
- TOTAL_BATCH_SIZE divisibility: shows actual values
- WINDOW_PATTERN validation: shows the invalid pattern
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.

1 participant