File size: 1,884 Bytes
ee0fd9a
 
 
bb617ad
ee0fd9a
 
 
 
 
 
5799d82
ee0fd9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
license: cc-by-nc-4.0
tags:
- audio-to-audio
- demucs
- libtorch
- coreml
- metal
- ios
- macos
pipeline_tag: audio-to-audio
---

# HTDemucs (LibTorch / CoreML Ready)

This repository contains **TorchScript (`.pt`)** exports of the [Hybrid Transformer Demucs (htdemucs)](https://github.com/facebookresearch/demucs) model by Meta Research. 

These models are optimized for **C++ Inference** (using LibTorch) on Apple Silicon (Metal/MPS) and CPU.

## ⚠️ License & Attribution

*   **Original Model Code:** MIT License (Copyright Meta Platforms, Inc.)
*   **Pre-Trained Weights:** [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) (Research constraints derived from training data).

**Attribution:** 
> Original work by **Meta Research**. Based on the paper "Hybrid Transformers for Music Source Separation" by Alexandre Défossez et al.
> Source Repository: [facebookresearch/demucs](https://github.com/facebookresearch/demucs)

**Disclaimer:** 
> This is a **format conversion only**. No fine-tuning was performed. The weights are numerically identical to the original release, but packaged for C++ execution without Python dependencies.

## Model Variants

| Filename | Description | Chunk Size | Target Device |
| :--- | :--- | :--- | :--- |
| `htdemucs_ft.pt` | **Fast Trace** (Recommended) | 8.0s | Metal (MPS) / GPU |
| `htdemucs_6s.pt` | **6-Stem** (Guitar/Piano) | 8.0s | Metal (MPS) / GPU |
| `htdemucs_cpu.pt` | CPU Fallback | 8.0s | CPU |

## Usage (C++)

These models are designed to be loaded directly in C++ using `torch::jit::load()`:

```cpp
#include <torch/script.h>

auto module = torch::jit::load("htdemucs_ft.pt");
module.to(torch::kMPS); // Or kCPU
module.eval();

// Input: [1, 2, Samples]
auto output = module.forward({input_tensor}).toTensor();
```

## Integrity

SHA256 checksums are provided in `SHA256SUMS.txt` to verify file integrity.