Skip to content

Conversation

@butsugiri
Copy link
Collaborator

@butsugiri butsugiri commented Nov 6, 2025

Currently, the means of setting random seed is different across different language models.
For example:

  • HuggingfaceLM: Seed is passed as an argument of LanguageModel
  • VLLM: Seed is passed as part of default_gen_kwargs dictionary.

This PR attempts to address this somewhat confusing behavior, by implementing set_random_seed method

logger.info(f"random seed: {random_seed}")
transformers.set_seed(random_seed)

def set_random_seed(self, seed: int) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also add a test case for hf_lm.py?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, it was my oversight.
Added tests in e1cb5aa

@butsugiri butsugiri mentioned this pull request Nov 6, 2025
@butsugiri
Copy link
Collaborator Author

Rebased to include the changes in #255

@butsugiri
Copy link
Collaborator Author

@junya-takayama CI looks OK now. Can you take another look, please? Thanks!

Copy link
Collaborator

@junya-takayama junya-takayama left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. LGTM!

@butsugiri butsugiri merged commit 831983e into main Nov 7, 2025
8 checks passed
@butsugiri butsugiri deleted the random-seed branch November 7, 2025 08:00
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