Skip to content

Conversation

@zboyles
Copy link

@zboyles zboyles commented Oct 4, 2025

Summary

This pull request adds MPS (Apple Silicon) device support for TTS with a non-breaking change to the Mimi model weight loading in src/liquid_audio/processor.py.

Problem

The safetensors library doesn't support loading weights directly to MPS devices, causing an error: device mps:0 is invalid when attempting to use the library on Apple Silicon Macs.

Solution

Added device detection logic in the mimi property to:

  • Load weights to CPU first when the target device is MPS
  • Let PyTorch automatically transfer weights to MPS during load_state_dict()
  • Preserve existing behavior for CUDA, CPU devices, and MPS devices using CPU (no changes)

Changes

  • Modified src/liquid_audio/processor.py: Added MPS device detection to conditionally load weights via CPU as an intermediate step

Impact

  • Non-breaking: No changes to existing CUDA/CPU workflows
  • Enables MPS support: Users can now run on Apple Silicon devices
  • Minimal change: Single-line conditional added for device compatibility

Copilot AI review requested due to automatic review settings October 4, 2025 00:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes TTS support for Apple Silicon Macs by addressing a safetensors library limitation with MPS device loading. The change enables MPS device compatibility while maintaining existing behavior for CUDA and CPU devices.

  • Adds device detection logic to handle MPS devices when loading Mimi model weights
  • Implements CPU-first loading strategy for MPS devices as a workaround for safetensors limitations
  • Preserves existing behavior for all other device types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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