Skip to content

Conversation

@beveradb
Copy link
Collaborator

@beveradb beveradb commented Sep 27, 2025

Overview

Updates the Roformer audio separation implementation to support the latest model architectures while maintaining full backward compatibility with existing models.

Problem Solved

  • Model Loading Failures: Fixed AttributeError: "'norm'" and TypeError: unexpected keyword argument - 'mlp_expansion_factor' errors when loading newer Roformer models
  • Parameter Incompatibility: Newer models with updated parameters (mlp_expansion_factor, sage_attention, zero_dc, use_torch_checkpoint, skip_connection) now load successfully
  • Normalization Issues: Resolved configuration handling in tfc_tdf_v3.py that caused AttributeError exceptions

Key Changes

🔧 Core Implementation

  • New Parameter Support: Added support for 5 new Roformer parameters in BSRoformer and MelBandRoformer models
  • Robust Fallback System: Implements try-new-first-fallback-to-old loading mechanism for maximum compatibility
  • Enhanced Configuration Handling: Smart parameter validation and normalization between old/new formats
  • Improved Error Reporting: Clear, actionable error messages for configuration mismatches

📁 New Components

  • audio_separator/separator/roformer/ - Complete parameter validation and loading system
  • Comprehensive fallback loader with multiple compatibility strategies
  • Configuration normalizer for seamless old/new format handling
  • Detailed model configuration validation with helpful error messages

🧪 Testing & Quality

  • 216 passing tests with comprehensive coverage
  • Contract tests ensuring interface compliance
  • Integration tests validating backward compatibility
  • Audio quality regression tests (≥0.90 waveform, ≥0.80 spectrogram similarity)
  • End-to-end separation tests for both old and new models

Backward Compatibility

  • Zero regression: All existing models continue to work identically
  • Automatic detection: System intelligently routes models to appropriate implementation
  • Graceful fallback: New implementation attempts first, falls back to old if needed
  • Preserved performance: No degradation in separation quality or speed

Architecture

  • Library-first design: Core functionality in reusable classes
  • Clean separation: Each model architecture in separate modules
  • Test-driven development: All features implemented with comprehensive test coverage
  • Constitutional compliance: Follows project architecture principles

@beveradb beveradb changed the title Update roformer implementation to support latest models Update roformer implementation to support BS-Roformer-SW Sep 27, 2025
@beveradb beveradb enabled auto-merge (squash) September 27, 2025 00:20
@beveradb beveradb merged commit cec32b7 into main Sep 28, 2025
13 checks passed
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.

2 participants