Skip to content

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

Merged
yiyixuxu merged 3 commits intohuggingface:mainfrom
azolotenkov:fix-seed-initialization
Mar 4, 2025
Merged

Fix incorrect seed initialization when args.seed is 0#10964
yiyixuxu merged 3 commits intohuggingface:mainfrom
azolotenkov:fix-seed-initialization

Conversation

@azolotenkov
Copy link
Copy Markdown
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
Copy Markdown
Member

@bot /style

@github-actions
Copy link
Copy Markdown
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