Skip to content

fix: add fallback for torchaudio/torchcodec loading and support PyTorch 2.6+ security policy#2749

Open
terrenceyeyang-code wants to merge 1 commit intoRVC-Boss:mainfrom
terrenceyeyang-code:fix/rtx50-pytorch2.6-compat
Open

fix: add fallback for torchaudio/torchcodec loading and support PyTorch 2.6+ security policy#2749
terrenceyeyang-code wants to merge 1 commit intoRVC-Boss:mainfrom
terrenceyeyang-code:fix/rtx50-pytorch2.6-compat

Conversation

@terrenceyeyang-code
Copy link
Copy Markdown

Fix: RTX 50-series Compatibility & PyTorch 2.6+ Security Policy Support

🔍 Problem Description

Tested on NVIDIA RTX 5080 with Python 3.12 and PyTorch 2.6.0, two critical issues were identified:

  1. TorchCodec/Torchaudio OSError: torchaudio.load() fails on Blackwell architecture GPUs due to torchcodec shared library loading errors. This crashes the inference WebUI and dataset preprocessing.
  2. PyTorch 2.6+ Checkpoint Loading: A change in PyTorch 2.6 (defaulting weights_only=True) prevents loading checkpoints containing pathlib.PosixPath objects, causing an UnpicklingError when resuming training.

🛠️ Proposed Solution

  • Audio Loading Fallback: Implemented a try-except wrapper for torchaudio.load(). If the C++ backend fails, it automatically falls back to librosa (CPU-based) to ensure the pipeline remains functional.
  • PyTorch 2.6 Security Alignment: Added pathlib.PosixPath to torch.serialization.add_safe_globals to allow safe unpickling of metadata during checkpoint restoration.
  • Code Cleanup: All new logic includes English comments for better maintainability.

🧪 Test Environment

  • GPU: NVIDIA RTX 5080
  • OS: Docker / Linux
  • Python/Torch: Python 3.12, PyTorch 2.6.0+cu124
  • Verification: Confirmed that inference, dataset formatting (2-get-sv), and training resumption work seamlessly with this patch.

Addresses compatibility for the upcoming generation of GPUs and the latest PyTorch stable releases.

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