--- license: cc-by-nc-4.0 base_model: ResembleAI/resemble-enhance tags: - mlx - audio - speech-enhancement - speech-denoising - apple-silicon library_name: mlx pipeline_tag: audio-to-audio --- # resemble-enhance-mlx MLX-compatible safetensors for [resemble-enhance](https://github.com/resemble-ai/resemble-enhance), converted for use with [resemble-enhance-swift](https://github.com/sammcj/resemble-enhance-swift) on Apple Silicon. These are the original Resemble AI weights, transformed for the MLX layout. No retraining or fine-tuning has been done. ## Files | File | Size | Purpose | |------|------|---------| | `denoiser.safetensors` | 41 MB | 2D UNet spectral-mask denoiser | | `lcfm_ae.safetensors` | 390 MB | IRMAE encoder/decoder (mel <-> 64-dim latent) | | `lcfm_cfm.safetensors` | 264 MB | Conditional flow matching, 30-layer WaveNet velocity field | | `vocoder.safetensors` | 662 MB | UnivNet vocoder (LVCNet generator) | | `normalizer.safetensors` | 160 B | Mel running mean/variance | Total: ~1.4 GB at float32. ## Usage With [resemble-enhance-swift](https://github.com/sammcj/resemble-enhance-swift): ```sh huggingface-cli download sammcj/resemble-enhance-mlx ``` The CLI and example SwiftUI app auto-discover weights from the HuggingFace hub cache (`~/.cache/huggingface/hub/models--sammcj--resemble-enhance-mlx/snapshots//`). You can also pass the directory explicitly: ```sh resemble-enhance enhance \ --model-dir ~/.cache/huggingface/hub/models--sammcj--resemble-enhance-mlx/snapshots// \ input.wav output.wav ``` Or from Swift: ```swift import ResembleEnhance let engine = try ResembleEnhance(modelDirectory: weightsURL) let enhanced = engine.enhance(samples: samples, sampleRate: 24_000) ``` ## Conversion Produced by `Scripts/convert_weights.py` in resemble-enhance-swift. The script: 1. Loads `mp_rank_00_model_states.pt` from the upstream PyTorch checkpoint (DeepSpeed format, wrapped in `["module"]`) 2. Fuses `weight_norm` parametrisations into plain `weight` tensors (handles both old `weight_g`/`weight_v` and new `parametrizations.weight.original*` formats) 3. Transposes conv kernels from PyTorch NCHW to MLX NHWC layout (`Conv1d` O,I,K -> O,K,I; `Conv2d` O,I,H,W -> O,H,W,I; `ConvTranspose1d` I,O,K -> O,K,I) 4. Transposes FIR filter buffers used by the alias-free resampler (same layout, since they're applied as conv kernels) 5. Splits the monolithic checkpoint into one safetensors file per component 6. Strips unused buffers (`dummy`, `mel_fn`, `mrstft`, training-only `estimator`) To reproduce: ```sh huggingface-cli download ResembleAI/resemble-enhance python Scripts/convert_weights.py ``` The output then matches what's in this repo. ## Source Derived from [ResembleAI/resemble-enhance](https://huggingface.co/ResembleAI/resemble-enhance). The original PyTorch checkpoint is `mp_rank_00_model_states.pt` from the `enhancer_stage2` training run. ## Licence and credit Released under CC-BY-NC-4.0, inheriting the upstream licence. Non-commercial use only. The model architecture, training data, training code, and original weights are the work of Resemble AI. This repo only contains the format conversion required to run the model on Apple Silicon via MLX. All credit for the model itself belongs to the original authors: - [resemble-enhance](https://github.com/resemble-ai/resemble-enhance) - [Resemble AI](https://www.resemble.ai/)