fix: PyTorch 2.6+ and torchmetrics v1.x compatibility#17
Open
ZJLi2013 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes compatibility issues when running GeometryForcing with PyTorch >= 2.6 and torchmetrics >= 1.0.
Changes
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.Handle torchmetrics v1.x API changes (3 files):
shared_registry.py:NoTrainLpipsandNoTrainInceptionV3were prefixed with_in torchmetrics v1.xlpips.py:_valid_imghelper and_LPIPS_AVAILABLEwere removed in newer versionsbase_fid.py:FrechetInceptionDistancemoved fromtorchmetrics.imagetotorchmetrics.image.fidAll fixes use
try/except ImportErrorto maintain backward compatibility with torchmetrics 0.11.x.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 onimgaugwhich uses removednp.sctypesin numpy 2.x)Testing
Verified end-to-end inference on
realestate10k_miniwith 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+.