Skip to content

fix: PyTorch 2.6+ and torchmetrics v1.x compatibility#17

Open
ZJLi2013 wants to merge 1 commit into
CIntellifusion:mainfrom
PhysicalAI-AIM:fix/pytorch26-torchmetrics-compat
Open

fix: PyTorch 2.6+ and torchmetrics v1.x compatibility#17
ZJLi2013 wants to merge 1 commit into
CIntellifusion:mainfrom
PhysicalAI-AIM:fix/pytorch26-torchmetrics-compat

Conversation

@ZJLi2013
Copy link
Copy Markdown

Summary

This PR fixes compatibility issues when running GeometryForcing with PyTorch >= 2.6 and torchmetrics >= 1.0.

Changes

  1. Fix tensor aliasing RuntimeError (dfot_video.py): PyTorch 2.6 enforces stricter checks on in-place operations with aliased tensors. Added .clone() before assigning predicted keyframes back to the prediction tensor.

  2. Handle torchmetrics v1.x API changes (3 files):

    • shared_registry.py: NoTrainLpips and NoTrainInceptionV3 were prefixed with _ in torchmetrics v1.x
    • lpips.py: _valid_img helper and _LPIPS_AVAILABLE were removed in newer versions
    • base_fid.py: FrechetInceptionDistance moved from torchmetrics.image to torchmetrics.image.fid

    All fixes use try/except ImportError to maintain backward compatibility with torchmetrics 0.11.x.

  3. Relax strict version pins (requirements.txt):

    • torchmetrics[image]==0.11.4>=0.11.4 (the strict pin conflicts with modern PyTorch)
    • pyiqa==0.1.10>=0.1.10 (0.1.10 depends on imgaug which uses removed np.sctypes in numpy 2.x)

Testing

Verified end-to-end inference on realestate10k_mini with PyTorch 2.6 on AMD MI300X (8 GPUs, DDP). 50-step DFoT denoising completed successfully, producing 3 demo videos.

These fixes are not GPU-vendor-specific — they apply equally to CUDA and ROCm environments running PyTorch 2.6+.

Fix tensor aliasing RuntimeError in dfot_video.py by cloning xs_pred_key before in-place assignment (PyTorch 2.6 stricter check). Handle torchmetrics v1.x API changes where NoTrainLpips, NoTrainInceptionV3, _valid_img, _LPIPS_AVAILABLE, and FrechetInceptionDistance were renamed or relocated. Relax strict version pins for torchmetrics and pyiqa in requirements.txt. Tested end-to-end inference on realestate10k_mini with PyTorch 2.6.
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.

1 participant