Skip to content

[benchmarks] Initialize moco and TPU experiments on XLA.#7257

Merged
ysiraichi merged 1 commit intomasterfrom
ysiraichi/init-moco-on-xla
Jun 18, 2024
Merged

[benchmarks] Initialize moco and TPU experiments on XLA.#7257
ysiraichi merged 1 commit intomasterfrom
ysiraichi/init-moco-on-xla

Conversation

@ysiraichi
Copy link
Copy Markdown
Collaborator

Fix: #6083

This PR partially fixes moco benchmark by initializing it using the XLA device, instead of its accelerator. Alongside benchmark#2292, this should fix moco for, at least, inference (training should be tested soon).

cc @miladm @JackCaoG @vanbasten23 @zpcore @frgossen

@ysiraichi ysiraichi requested review from frgossen and zpcore June 12, 2024 19:20
device = (
str(self.benchmark_experiment.get_device())
if self.is_accelerator_tpu() else self.benchmark_experiment.accelerator)
if self.should_initialize_on_xla():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you remind me why we didn't initialize on CUDA device for GPU experiment before? Thanks

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We actually do initialize them on CUDA device (i.e. self.benchmark_experiment.accelerator). The thing is that for moco we have to initialize the benchmark on XLA device (i.e. str(self.benchmark_experiment.get_device())).

Comment thread benchmarks/torchbench_model.py Outdated
if self.benchmark_experiment.xla and not self.should_initialize_on_xla():
# First, move the model and the inputs to CPU.
# This avoids having dupplicated data on CUDA.
if self.is_accelerator_cuda():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you may want to do a rebase.

@ysiraichi ysiraichi force-pushed the ysiraichi/init-moco-on-xla branch from 5b7f9b7 to 150941d Compare June 17, 2024 22:53
@ysiraichi ysiraichi merged commit abf5c31 into master Jun 18, 2024
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.

[torchbench] moco fails to run.

3 participants