Skip to content

Correct grammatical typo in label smoothing ValueError - #3641

Merged
zcbenz merged 1 commit into
ml-explore:mainfrom
madhav1k:main
Jun 9, 2026
Merged

zcbenz merged 1 commit into
ml-explore:mainfrom
madhav1k:main

Conversation

@madhav1k

@madhav1k madhav1k commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

This PR fixes a minor grammatical typo in the ValueError message raised when the label_smoothing parameter in cross_entropy is out of the valid [0, 1) range.

Before: "Label smoothing must in [0, 1), got {label_smoothing}."
After: "Label smoothing must be in [0, 1), got {label_smoothing}."

While simple, error messages are a primary interface for developers using MLX. Grammatically correct and clear error messages:

  1. Enhance Developer Experience (DX): Prevent momentary cognitive overhead or confusion when a user is diagnosing parameter issues during training configuration.
  2. Polished API Presentation: Keep the library's developer-facing interface clean and professional.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

Correct a grammatical typo in the ValueError message raised when label_smoothing is out of range in cross_entropy. Changes "must in [0, 1)" to "must be in [0, 1)" to improve clarity (python/mlx/nn/losses.py).

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@zcbenz
zcbenz merged commit c7b2b9d into ml-explore:main Jun 9, 2026
42 of 48 checks passed
@BrewTestBot BrewTestBot mentioned this pull request Jul 7, 2026
1 task done
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