Is there an existing issue for this?
Operating System
Window 11
DeepLabCut version
3.0.0rc14 (PyTorch engine)
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
AMD Radeon RX 5700 XT
Bug description 🐛
When running analyze_videos using an AMD GPU via the DirectML backend, the process fails with the following error:
RuntimeError: Cannot set version_counter for inference tensor
This occurs during the ConvTranspose2d operation in the model's head.
Steps To Reproduce
The issue is caused by the @torch.inference_mode() decorator in pose_estimation_pytorch/runners/inference.py. Tensors created in inference_mode are immutable and have restricted version counting, which is currently incompatible with the DirectML backend for specific convolutional kernels like ConvTranspose2d.
Relevant log output
Final Verified Workaround
Replacing `@torch.inference_mode()` with `@torch.no_grad()` in the following file/lines fixes the issue and allows the AMD GPU to be utilized correctly via DirectML:
**File:** `deeplabcut/pose_estimation_pytorch/runners/inference.py`
**Lines:** 267 and 682
By switching to `no_grad`, the tensors are compatible with the DirectML execution path, enabling full hardware acceleration for AMD users.
Anything else?
No response
Code of Conduct
Is there an existing issue for this?
Operating System
Window 11
DeepLabCut version
3.0.0rc14 (PyTorch engine)
What engine are you using?
pytorch
DeepLabCut mode
single animal
Device type
AMD Radeon RX 5700 XT
Bug description 🐛
When running
analyze_videosusing an AMD GPU via the DirectML backend, the process fails with the following error:RuntimeError: Cannot set version_counter for inference tensorThis occurs during the
ConvTranspose2doperation in the model's head.Steps To Reproduce
The issue is caused by the
@torch.inference_mode()decorator inpose_estimation_pytorch/runners/inference.py. Tensors created ininference_modeare immutable and have restricted version counting, which is currently incompatible with the DirectML backend for specific convolutional kernels likeConvTranspose2d.Relevant log output
Anything else?
No response
Code of Conduct