From da2fb4e20d8ea4c78fb4cc36a7e3a0fa2bb5b5d2 Mon Sep 17 00:00:00 2001 From: Dmitry Rogozhkin Date: Mon, 30 Jun 2025 18:12:25 +0000 Subject: [PATCH] imagenet: fix typo addressing args.gpu Fixes: dcc2474 ("Add Accelerator Api to Imagenet Example") Signed-off-by: Dmitry Rogozhkin --- imagenet/main.py | 2 +- run_python_examples.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/imagenet/main.py b/imagenet/main.py index f5e7dc86e5..abd6640367 100644 --- a/imagenet/main.py +++ b/imagenet/main.py @@ -372,7 +372,7 @@ def run_validate(loader, base_progress=0): i = base_progress + i if use_accel: if args.gpu is not None and device.type=='cuda': - torch.accelerator.set_device_index(argps.gpu) + torch.accelerator.set_device_index(args.gpu) images = images.cuda(args.gpu, non_blocking=True) target = target.cuda(args.gpu, non_blocking=True) else: diff --git a/run_python_examples.sh b/run_python_examples.sh index c9c90f9552..dab3b3998a 100755 --- a/run_python_examples.sh +++ b/run_python_examples.sh @@ -81,6 +81,7 @@ function imagenet() { cp sample/train/n/* sample/val/n/ fi uv run main.py --epochs 1 sample/ || error "imagenet example failed" + uv run main.py --epochs 1 --gpu 0 sample/ || error "imagenet example failed" } function language_translation() {