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

Re-land: Fix model initialization. #6296

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

ysiraichi
Copy link
Collaborator

@ysiraichi ysiraichi commented Jan 11, 2024

Re-land: #6182 #6076

Here are the issues found with the last try:

  • benchmark_cls was being incorrectly instantiated twice
    • Using: (i) the specified accelerator; and (ii) the device returned from benchmark_experiment.get_device()
  • The returned instance was (ii), which caused the regression
  • example_inputs was being reset after being moved to XLA

As a solution, in this PR:

  • benchmark_cls is instantiated once, with the specified accelerator
  • self.module and self.example_inputs are moved to XLA in the set_up method

I have run the benchmarks mentioned in #6182 and confirmed no regression is present.

cc @miladm @JackCaoG

device = "cuda"
else:
device = str(self.benchmark_experiment.get_device())

return benchmark_cls(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to force bnechmark_cls to only run once so that we don't have the problem next time? Perhaps https://stackoverflow.com/questions/4103773/efficient-way-of-having-a-function-only-execute-once-in-a-loop

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. I will do it in a follow-up PR.

Copy link
Collaborator

@vanbasten23 vanbasten23 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 fixing it!

Copy link
Collaborator

@frgossen frgossen 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 fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants