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

Use pytorch pinned torchbench instead of torch-xpu-ops pinned #1226

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

mengfei25
Copy link
Contributor

No description provided.

@mengfei25 mengfei25 requested a review from chuanqi129 December 27, 2024 05:43
@mengfei25
Copy link
Contributor Author

Yolo v3 will crash for checking CUDA device
Traceback (most recent call last):
File "/home/sdp/actions-runner/_work/torch-xpu-ops/pytorch/benchmarks/dynamo/common.py", line 4886, in run
) = runner.load_model(
File "/home/sdp/actions-runner/_work/torch-xpu-ops/pytorch/benchmarks/dynamo/torchbench.py", line 312, in load_model
benchmark = benchmark_cls(
File "/home/sdp/actions-runner/_work/torch-xpu-ops/benchmark/torchbenchmark/util/model.py", line 24, in call
obj = type.call(cls, *args, **kwargs)
File "/home/sdp/actions-runner/_work/torch-xpu-ops/benchmark/torchbenchmark/models/yolov3/init.py", line 58, in init
self.training_loop, self.model, self.example_inputs = prepare_training_loop(
File "/home/sdp/actions-runner/_work/torch-xpu-ops/benchmark/torchbenchmark/models/yolov3/yolo_train.py", line 630, in prepare_training_loop
device = torch_utils.select_device(
File "/home/sdp/actions-runner/_work/torch-xpu-ops/benchmark/torchbenchmark/models/yolov3/yolo_utils/torch_utils.py", line 31, in select_device
assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device # check availablity
AssertionError: CUDA unavailable, invalid device xpu requested

@mengfei25
Copy link
Contributor Author

mengfei25 commented Dec 27, 2024

https://github.com/pytorch/benchmark/blob/766a5e3a189384659fd35a68c3b17b88c761aaac/torchbenchmark/models/yolov3/yolo_utils/torch_utils.py#L28-L31
The XPU was lost.

def select_device(device='', apex=False, batch_size=None):
    # device = 'cpu' or '0' or '0,1,2,3'
    cpu_request = device.lower() == 'cpu'
    if device and not cpu_request:  # if device requested other than 'cpu'
        os.environ['CUDA_VISIBLE_DEVICES'] = device  # set environment variable
        assert torch.cuda.is_available(), 'CUDA unavailable, invalid device %s requested' % device  # check availablity

@mengfei25 mengfei25 enabled auto-merge December 27, 2024 14:36
@mengfei25 mengfei25 added this pull request to the merge queue Dec 27, 2024
Merged via the queue into main with commit c30d744 Dec 27, 2024
3 checks passed
@mengfei25 mengfei25 deleted the mengfeil/torchbench branch December 27, 2024 14:37
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.

2 participants