chongjing commited on
Sync README from GitHub
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CPR: Composer–Performer and Refiner
|
| 2 |
+
|
| 3 |
+
1. **Composer–Performer (CP)** takes prompt audio, prompt MIDI, and target MIDI,
|
| 4 |
+
and writes **24 kHz mono audio**. The Composer is an autoregressive Qwen3
|
| 5 |
+
Transformer; the Performer renders local Mel patches with flow matching.
|
| 6 |
+
A Vocos vocoder converts the generated Mel features to audio.
|
| 7 |
+
2. **Refiner (R)** takes a **24 kHz audio file** and writes **48 kHz mono audio**
|
| 8 |
+
using the LavaSR-based bandwidth-extension model and low-frequency fusion.
|
| 9 |
+
|
| 10 |
+
## Installation
|
| 11 |
+
|
| 12 |
+
Create a dedicated Conda environment with Python 3.10:
|
| 13 |
+
|
| 14 |
+
```bash
|
| 15 |
+
conda create -n cpr python=3.10 pip -y
|
| 16 |
+
conda activate cpr
|
| 17 |
+
python -m pip install -r requirements.txt
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
On the first CP run, CLAP automatically downloads and caches its RoBERTa initialization resources.
|
| 21 |
+
|
| 22 |
+
## Checkpoints
|
| 23 |
+
|
| 24 |
+
Download the inference assets from [bruceL33/CPR on Hugging Face](https://huggingface.co/bruceL33/CPR).
|
| 25 |
+
Run the following command from the code repository root with the `cpr` Conda environment activated.
|
| 26 |
+
|
| 27 |
+
Download the four files directly into `checkpoints/`:
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
hf download bruceL33/CPR \
|
| 31 |
+
composer_performer.safetensors \
|
| 32 |
+
composer_performer_config.json \
|
| 33 |
+
vocos.safetensors \
|
| 34 |
+
refiner.bin \
|
| 35 |
+
--local-dir checkpoints
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
| Component | File under `checkpoints/` |
|
| 39 |
+
|---|---|
|
| 40 |
+
| Composer–Performer | `composer_performer.safetensors` |
|
| 41 |
+
| Model architecture and Qwen configuration | `composer_performer_config.json` |
|
| 42 |
+
| 24 kHz Vocos vocoder | `vocos.safetensors` |
|
| 43 |
+
| Refiner | `refiner.bin` |
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
### Download CLAP
|
| 47 |
+
|
| 48 |
+
CLAP is required for Composer–Performer inference. Download the official music checkpoint
|
| 49 |
+
[music_audioset_epoch_15_esc_90.14.pt](https://huggingface.co/lukewys/laion_clap/blob/main/music_audioset_epoch_15_esc_90.14.pt) and save it as `checkpoints/clap.pt`:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
mkdir -p checkpoints
|
| 53 |
+
curl --fail --location \
|
| 54 |
+
--output checkpoints/clap.pt \
|
| 55 |
+
https://huggingface.co/lukewys/laion_clap/resolve/main/music_audioset_epoch_15_esc_90.14.pt
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Inference
|
| 59 |
+
|
| 60 |
+
Run commands from the repository root. The included [piano example](examples/piano/README.md)
|
| 61 |
+
contains three inputs: `prompt.wav`, `prompt.mid`, and `target.mid`.
|
| 62 |
+
|
| 63 |
+
### 1. Composer–Performer → 24 kHz
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
bash scripts/infer_cp.sh
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
### 2. Refiner → 48 kHz
|
| 70 |
+
|
| 71 |
+
use any existing 24 kHz WAV:
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
python infer_refiner.py --input /path/to/audio_24k.wav --output outputs/refined.wav
|
| 75 |
+
```
|