Skip to content

Fix incorrect seed initialization when args.seed is 0 #10964

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

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

azolotenkov
Copy link
Contributor

What does this PR do?

When args.seed is set to 0, the condition if args.seed else None evaluates to None because 0 is considered a falsy value in Python. This results in None being assigned instead of 0, which can cause unintended behavior when initializing the random generator.

Before submitting

Who can review?

@sayakpaul

@sayakpaul
Copy link
Member

@bot /style

Copy link
Contributor

github-actions bot commented Mar 4, 2025

Style fixes have been applied. View the workflow run here.

@yiyixuxu yiyixuxu merged commit b8215b1 into huggingface:main Mar 4, 2025
@azolotenkov azolotenkov deleted the fix-seed-initialization branch March 5, 2025 13:38
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.

3 participants