From f27ac50f1dcdb71b9f66ae2225ed11f3a0c860bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Thu, 27 Nov 2025 13:43:26 +0100 Subject: [PATCH] Pin PyTorch <2.4.0 for AudioCraft compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AudioCraft requires PyTorch 2.1.x. PyTorch 2.4+ changed the torch.utils._pytree API (serialized_type_name parameter), breaking AudioCraft's model loading. - Pin torch>=2.1.0,<2.4.0 - Pin torchaudio>=2.1.0,<2.4.0 - Remove broken pytree monkey-patch attempt After pulling, reinstall with: pip install -r requirements.txt --force-reinstall torch torchaudio 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- main.py | 11 ----------- requirements.txt | 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 02ae944..d412677 100644 --- a/main.py +++ b/main.py @@ -16,17 +16,6 @@ os.chdir(PROJECT_ROOT) # Add project root to path sys.path.insert(0, str(PROJECT_ROOT)) -# PyTorch 2.5+ compatibility patch for audiocraft -# The _pytree API changed - add backwards compatibility -try: - import torch.utils._pytree as _pytree - if not hasattr(_pytree, 'register_pytree_node') and hasattr(_pytree, '_register_pytree_node'): - _pytree.register_pytree_node = _pytree._register_pytree_node - elif not hasattr(_pytree, '_register_pytree_node') and hasattr(_pytree, 'register_pytree_node'): - _pytree._register_pytree_node = _pytree.register_pytree_node -except Exception: - pass # Ignore if patch fails - from config.settings import get_settings from src.core.gpu_manager import GPUMemoryManager from src.core.model_registry import ModelRegistry diff --git a/requirements.txt b/requirements.txt index 8bc3e48..1130f5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -# Core ML -torch>=2.1.0 -torchaudio>=2.1.0 +# Core ML - Pin to AudioCraft-compatible versions (2.4+ breaks pytree API) +torch>=2.1.0,<2.4.0 +torchaudio>=2.1.0,<2.4.0 audiocraft>=1.3.0 xformers>=0.0.22