Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nans with higher epsilon #19

Closed
wants to merge 2 commits into from
Closed

Conversation

nathanjzhao
Copy link
Contributor

Nans resulted from logprobability being miscalculated from near-zero std


entropy_loss = jnp.mean(0.5 * (jnp.log(2 * jnp.pi * (std_b + 1e-8) ** 2) + 1))
entropy_loss = jnp.mean(0.5 * (jnp.log(2 * jnp.pi * (std_b + 1e-4) ** 2) + 1))
Copy link
Member

Choose a reason for hiding this comment

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

oh yea - you should use 1e-5 for eps when training fp16 models bc the minimum positive value is $2^{-24} \approx 5 \times 10^{-8}$

Copy link
Contributor Author

Choose a reason for hiding this comment

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

damn knowing that would've saved me a lot of time lol

@codekansas codekansas closed this Aug 20, 2024
@codekansas codekansas deleted the nans-fix-with-epsilon branch August 20, 2024 22:19
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