huyquoctrinh commited on
Commit
7b23a3a
·
verified ·
1 Parent(s): 6d07b7d

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,200 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - music-editing
5
+ - audio
6
+ - multimodal
7
+ - conversational-ai
8
+ - lora
9
+ - musicgen
10
+ - qwen2.5-omni
11
+ language:
12
+ - en
13
+ pipeline_tag: audio-to-audio
14
+ datasets:
15
+ - OpenRB-Lab/AURA-Chat-Edit
16
  ---
17
+
18
+ # AURA: Unified Multimodal Framework for Conversational Music Editing
19
+
20
+ [![arXiv](https://img.shields.io/badge/arXiv-TODO-b31b1b.svg)](https://arxiv.org/abs/TODO)
21
+ [![GitHub](https://img.shields.io/badge/GitHub-AURA-blue.svg)](https://github.com/OpenRB-Lab/AURA)
22
+ [![Dataset](https://img.shields.io/badge/🤗_Dataset-AURA--Chat--Edit-yellow.svg)](https://huggingface.co/datasets/OpenRB-Lab/AURA-Chat-Edit)
23
+
24
+
25
+ ## Overview
26
+
27
+ **AURA** is a conversational music-editing agent that listens to a song and a natural-language instruction, replies conversationally, and renders the edited audio. The system consists of three components:
28
+
29
+ - **Thinker** — A [Qwen2.5-Omni-7B](https://huggingface.co/Qwen/Qwen2.5-Omni-7B) model fine-tuned with LoRA (r=16, alpha=32). It processes audio and text, generates conversational replies, and emits typed edit-token blocks `[EDIT_<KIND>][EDIT_0..7]` (7 kinds: ADD / REMOVE / REPLACE / EXTRACT / REBALANCE / EFFECT / MOOD).
30
+ - **Bridge** — A dual-stream fusion MusicGen decoder based on [facebook/musicgen-medium](https://huggingface.co/facebook/musicgen-medium). The 9 hidden states at the edit tokens condition the bridge via **BiFAM** (Bi-FiLM Attention Module: shared-query dual attention + FiLM modulation) and cross-attention K/V with LoRA (r=64, alpha=128). Includes learned projectors (258 MB) mapping from the thinker's hidden dimension to MusicGen's space.
31
+ - **Classifier** — An `EditSemanticClassifier` (two-head: edit kind + instrument) used by the programmatic planner for stem routing.
32
+
33
+ Localized edits are code-anchored outside the requested segment and seam-crossfaded via a stem-hybrid executor (HTDemucs-6s separation).
34
+
35
+ ## Model Checkpoints
36
+
37
+ | File | Description | Size |
38
+ |------|-------------|------|
39
+ | `config.yaml` | Training configuration (paths, hyperparameters) | 1 KB |
40
+ | `thinker/adapter_config.json` | Thinker LoRA configuration | 1 KB |
41
+ | `thinker/adapter_model.safetensors` | Thinker LoRA weights (Qwen2.5-Omni-7B, r=16) | 2.0 GB |
42
+ | `bridge/projectors.pt` | Learned projectors (d_llm=3584 → d_musicgen=2048) + FiLM MLPs/alphas/gates | 258 MB |
43
+ | `bridge/lora/adapter_config.json` | Bridge LoRA configuration | 1 KB |
44
+ | `bridge/lora/adapter_model.safetensors` | Bridge LoRA weights (MusicGen encoder_attn k/v, r=64) | 37 MB |
45
+ | `classifier/classifier.pt` | EditSemanticClassifier (kind + instrument heads) | 14 MB |
46
+
47
+ **Total checkpoint size: ~2.3 GB** (adapters only — base models downloaded separately)
48
+
49
+ ### Thinker Details
50
+
51
+ - **Base model**: [Qwen/Qwen2.5-Omni-7B](https://huggingface.co/Qwen/Qwen2.5-Omni-7B)
52
+ - **LoRA config**: r=16, alpha=32, dropout=0.05
53
+ - **Target modules**: `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
54
+ - **Modules to save**: `embed_tokens`, `lm_head` (for custom edit tokens)
55
+ - **Training**: 2-epoch SFT on dialogue data, then joint training with bridge (4000 steps, λ=0.5 convex loss)
56
+
57
+ ### Bridge Details
58
+
59
+ - **Base model**: [facebook/musicgen-medium](https://huggingface.co/facebook/musicgen-medium) (1.5B params, frozen decoder)
60
+ - **Fusion mechanism**: BiFAM — shared-query dual cross-attention over edit-token hidden states + gated FiLM modulation at each decoder layer
61
+ - **LoRA config**: r=64, alpha=128, dropout=0.05, targeting `encoder_attn.{k_proj, v_proj}`
62
+ - **Projectors**: Linear projections from thinker hidden dim (3584) to MusicGen dim (2048), plus FiLM MLP layers
63
+ - **Cross-attention layers**: [0, 2, 4, 6, 8, 10, 12, 14]
64
+ - **Training**: 40k steps bridge-only, then 4000 steps joint with thinker
65
+
66
+ ### Classifier Details
67
+
68
+ - **Architecture**: Two-head classifier (edit kind: 7 classes, instrument: multi-label)
69
+ - **Input**: 9 edit-token hidden states (pooled)
70
+ - **Used by**: Programmatic planner for stem routing decisions
71
+
72
+ ## Quick Start
73
+
74
+ ### 1. Download base models
75
+
76
+ The base models are downloaded automatically on first use, or you can pre-download them:
77
+
78
+ ```python
79
+ from huggingface_hub import snapshot_download
80
+
81
+ # Thinker base model (~15 GB)
82
+ snapshot_download("Qwen/Qwen2.5-Omni-7B", cache_dir="weights")
83
+
84
+ # Bridge base model (~3.3 GB)
85
+ snapshot_download("facebook/musicgen-medium", cache_dir="weights")
86
+ ```
87
+
88
+ ### 2. Download AURA checkpoints
89
+
90
+ ```python
91
+ from huggingface_hub import snapshot_download
92
+
93
+ # Download all AURA adapters (~2.3 GB)
94
+ repo_dir = snapshot_download("OpenRB-Lab/AURA")
95
+ ```
96
+
97
+ Or download individual components:
98
+
99
+ ```python
100
+ from huggingface_hub import hf_hub_download
101
+
102
+ # Thinker LoRA adapter
103
+ thinker_config = hf_hub_download("OpenRB-Lab/AURA", "thinker/adapter_config.json")
104
+ thinker_weights = hf_hub_download("OpenRB-Lab/AURA", "thinker/adapter_model.safetensors")
105
+
106
+ # Bridge projectors + LoRA
107
+ projectors = hf_hub_download("OpenRB-Lab/AURA", "bridge/projectors.pt")
108
+ bridge_config = hf_hub_download("OpenRB-Lab/AURA", "bridge/lora/adapter_config.json")
109
+ bridge_weights = hf_hub_download("OpenRB-Lab/AURA", "bridge/lora/adapter_model.safetensors")
110
+
111
+ # Classifier
112
+ classifier = hf_hub_download("OpenRB-Lab/AURA", "classifier/classifier.pt")
113
+ ```
114
+
115
+ ### 3. Usage
116
+
117
+ ```python
118
+ # Point environment to your checkpoint directory
119
+ import os
120
+ os.environ["AURA_QWEN"] = "path/to/aura1/thinker"
121
+ os.environ["AURA_MG"] = "path/to/aura1/bridge"
122
+ os.environ["AURA_CLASSIFIER"] = "path/to/aura1/classifier/classifier.pt"
123
+
124
+ # Load the engine
125
+ from serving.engine import AuraEngine
126
+
127
+ engine = AuraEngine(device="cuda")
128
+ result = engine.edit(
129
+ audio_path="path/to/song.wav",
130
+ instruction="Add a jazzy saxophone melody to the chorus",
131
+ guidance=2.0,
132
+ seed=1234,
133
+ max_seconds=5.0
134
+ )
135
+
136
+ # result["reply"] -> conversational text response
137
+ # result["wav"] -> edited audio (float32 numpy, 32 kHz)
138
+ # result["sr"] -> 32000
139
+ ```
140
+
141
+ ### 4. Serving
142
+
143
+ ```bash
144
+ # HTTP API
145
+ API_GPU=0 API_PORT=9004 bash src/scripts/serve_musicgen_api.sh
146
+
147
+ # Gradio web UI
148
+ WORKER_URL=http://127.0.0.1:9004 \
149
+ SFT_ADAPTER=path/to/aura1/thinker \
150
+ WEBAPP_PORT=7862 CUDA_VISIBLE_DEVICES=1 \
151
+ python src/edit_agent/webapp.py
152
+ ```
153
+
154
+ ## Training Configuration
155
+
156
+ Training uses a 3-stage pipeline:
157
+
158
+ 1. **Stage 1 — Thinker SFT**: LoRA fine-tuning on conversational music-edit dialogues (2 epochs, lr=1e-4)
159
+ 2. **Stage 2 — Bridge**: Fusion adapter training on cached thinker hidden states (40k steps, lr=5e-5)
160
+ 3. **Stage 3 — Joint**: End-to-end training with live thinker + bridge (4k steps, loss = λ·CE_musicgen + (1−λ)·CE_LM)
161
+
162
+ See `config.yaml` for the full training configuration.
163
+
164
+ ## Results
165
+
166
+ Production checkpoints (`joint_fusion_r64/final`):
167
+
168
+ | Benchmark | FAD ↓ | CLAP ↑ | SSIM ↑ |
169
+ |-----------|-------|--------|--------|
170
+ | IMPG Add | 1.49 | — | — |
171
+ | IMPG Remove | 1.36 | — | — |
172
+ | IMPG Extract | 6.13 | — | — |
173
+ | Mixed 60-clip | 2.15 | 0.661 (MuLan cos) | — |
174
+
175
+ ### Fusion Ablation (IMPG Benchmark)
176
+
177
+ | Method | FAD ↓ | CLAP ↑ | SSIM ↑ |
178
+ |--------|-------|--------|--------|
179
+ | **BiFAM (Ours)** | **0.41** | 0.218 | **0.776** |
180
+ | Cross-Attention Only | 2.48 | **0.263** | 0.099 |
181
+ | Concatenation Only | 13.64 | 0.181 | 0.115 |
182
+
183
+ ## Citation
184
+
185
+ ```bibtex
186
+ @inproceedings{trinh2026aura,
187
+ title = {AURA: Unified Multimodal Framework for Conversational Music Editing},
188
+ author = {Trinh, Quoc-Huy and Nguyen, Minh-Van and Jha, Debesh},
189
+ year = {2026},
190
+ note = {arXiv preprint, arXiv:TODO (to appear)}
191
+ }
192
+ ```
193
+
194
+ ## License
195
+
196
+ This project is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.
197
+
198
+ **Note**: The base models have their own licenses:
199
+ - Qwen2.5-Omni-7B: [Apache 2.0](https://huggingface.co/Qwen/Qwen2.5-Omni-7B)
200
+ - MusicGen-medium: [CC-BY-NC 4.0](https://huggingface.co/facebook/musicgen-medium)
bridge/lora/adapter_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "MusicgenForCausalLM",
7
+ "parent_library": "transformers.models.musicgen.modeling_musicgen"
8
+ },
9
+ "base_model_name_or_path": "",
10
+ "bias": "none",
11
+ "corda_config": null,
12
+ "ensure_weight_tying": false,
13
+ "eva_config": null,
14
+ "exclude_modules": null,
15
+ "fan_in_fan_out": false,
16
+ "inference_mode": true,
17
+ "init_lora_weights": true,
18
+ "layer_replication": null,
19
+ "layers_pattern": null,
20
+ "layers_to_transform": null,
21
+ "loftq_config": {},
22
+ "lora_alpha": 128,
23
+ "lora_bias": false,
24
+ "lora_dropout": 0.05,
25
+ "megatron_config": null,
26
+ "megatron_core": "megatron.core",
27
+ "modules_to_save": null,
28
+ "peft_type": "LORA",
29
+ "peft_version": "0.18.1",
30
+ "qalora_group_size": 16,
31
+ "r": 64,
32
+ "rank_pattern": {},
33
+ "revision": null,
34
+ "target_modules": ".*encoder_attn\\.(k_proj|v_proj)",
35
+ "target_parameters": null,
36
+ "task_type": null,
37
+ "trainable_token_indices": null,
38
+ "use_dora": false,
39
+ "use_qalora": false,
40
+ "use_rslora": false
41
+ }
bridge/lora/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f8d1ccba7e5a286137abce488cf1927f5a0a7b3f1a943fa3127804c2c171941
3
+ size 37776848
bridge/projectors.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1a935af50219d69f74ff8262838e1f5020edb20c4862b5860d45a9111c6a908
3
+ size 258696730
classifier/classifier.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a3881430ad35d94ed48ab466ca386fa1dfbb99cfc123ad13cea041b62e8d673
3
+ size 14778039
config.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Edit-agent configuration (dialogue SFT + later bridge stages)
2
+
3
+ paths:
4
+ dataset_jsonl: data/edit_dataset/manifests/dataset.jsonl
5
+ dialogues_jsonl: data/edit_dataset/dialogues/dialogues.jsonl
6
+ bridge_cache_dir: data/edit_dataset/bridge_cache
7
+ ckpt_root: ckpts/edit_agent
8
+
9
+ tokens:
10
+ k_edit: 8
11
+
12
+ qwen:
13
+ model_id: Qwen/Qwen2.5-Omni-7B
14
+ attn: sdpa
15
+ dtype: bf16
16
+
17
+ sft:
18
+ lora: {r: 16, alpha: 32, dropout: 0.05}
19
+ lr: 1.0e-4
20
+ batch: 1
21
+ grad_accum: 16
22
+ epochs: 2
23
+ warmup: 300
24
+ log_every: 10
25
+ save_every: 500
26
+
27
+ # Stage A (bridge) — filled in when that stage is implemented
28
+ bridge:
29
+ d_llm: 3584
30
+ dit_dim: 2048
31
+ cross_attn_layers: [0, 2, 4, 6, 8, 10, 12, 14]
32
+ lora: {r: 16, alpha: 32}
33
+ drops: {edit_cond: 0.1, src_cond: 0.1}
34
+ loss_w: {flow: 1.0, align: 1.0, nce: 0.5}
thinker/adapter_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen2.5-Omni-7B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 32,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": [
25
+ "embed_tokens",
26
+ "lm_head"
27
+ ],
28
+ "peft_type": "LORA",
29
+ "peft_version": "0.18.1",
30
+ "qalora_group_size": 16,
31
+ "r": 16,
32
+ "rank_pattern": {},
33
+ "revision": null,
34
+ "target_modules": "model\\.layers\\.\\d+\\.(self_attn\\.(q_proj|k_proj|v_proj|o_proj)|mlp\\.(gate_proj|up_proj|down_proj))",
35
+ "target_parameters": null,
36
+ "task_type": "CAUSAL_LM",
37
+ "trainable_token_indices": null,
38
+ "use_dora": false,
39
+ "use_qalora": false,
40
+ "use_rslora": false
41
+ }
thinker/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54f10ba5b9a01da952544335847e8e0d78aef8c90960c2c391e01fd7469a9ca9
3
+ size 2341522936