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() {