audiyo 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- audiyo-0.0.1/LICENSE +214 -0
- audiyo-0.0.1/PKG-INFO +176 -0
- audiyo-0.0.1/README.md +137 -0
- audiyo-0.0.1/pyproject.toml +55 -0
- audiyo-0.0.1/setup.cfg +4 -0
- audiyo-0.0.1/src/audiyo/__init__.py +36 -0
- audiyo-0.0.1/src/audiyo/_version.py +1 -0
- audiyo-0.0.1/src/audiyo/adapters/__init__.py +6 -0
- audiyo-0.0.1/src/audiyo/adapters/meta.py +46 -0
- audiyo-0.0.1/src/audiyo/adapters/targets.py +43 -0
- audiyo-0.0.1/src/audiyo/audio.py +127 -0
- audiyo-0.0.1/src/audiyo/backend.py +74 -0
- audiyo-0.0.1/src/audiyo/benchmark.py +98 -0
- audiyo-0.0.1/src/audiyo/benchutils/__init__.py +6 -0
- audiyo-0.0.1/src/audiyo/benchutils/env.py +34 -0
- audiyo-0.0.1/src/audiyo/benchutils/runner.py +15 -0
- audiyo-0.0.1/src/audiyo/chunked.py +40 -0
- audiyo-0.0.1/src/audiyo/cli/__init__.py +5 -0
- audiyo-0.0.1/src/audiyo/cli/chat.py +178 -0
- audiyo-0.0.1/src/audiyo/cli/finetune_cmd.py +28 -0
- audiyo-0.0.1/src/audiyo/cli/generate_cmd.py +35 -0
- audiyo-0.0.1/src/audiyo/cli/info_cmd.py +71 -0
- audiyo-0.0.1/src/audiyo/cli/main.py +56 -0
- audiyo-0.0.1/src/audiyo/cli/parser.py +56 -0
- audiyo-0.0.1/src/audiyo/config.py +119 -0
- audiyo-0.0.1/src/audiyo/dataio/__init__.py +7 -0
- audiyo-0.0.1/src/audiyo/dataio/channels.py +16 -0
- audiyo-0.0.1/src/audiyo/dataio/extensions.py +14 -0
- audiyo-0.0.1/src/audiyo/dataio/windows.py +24 -0
- audiyo-0.0.1/src/audiyo/datasets.py +198 -0
- audiyo-0.0.1/src/audiyo/errors.py +66 -0
- audiyo-0.0.1/src/audiyo/hardware.py +104 -0
- audiyo-0.0.1/src/audiyo/inference/__init__.py +7 -0
- audiyo-0.0.1/src/audiyo/inference/generator.py +9 -0
- audiyo-0.0.1/src/audiyo/inference/outputs.py +38 -0
- audiyo-0.0.1/src/audiyo/inference/performance.py +29 -0
- audiyo-0.0.1/src/audiyo/lora.py +94 -0
- audiyo-0.0.1/src/audiyo/memopt/__init__.py +6 -0
- audiyo-0.0.1/src/audiyo/memopt/applier.py +43 -0
- audiyo-0.0.1/src/audiyo/memopt/presets.py +54 -0
- audiyo-0.0.1/src/audiyo/memory.py +99 -0
- audiyo-0.0.1/src/audiyo/model.py +304 -0
- audiyo-0.0.1/src/audiyo/testkit/__init__.py +6 -0
- audiyo-0.0.1/src/audiyo/testkit/modules.py +199 -0
- audiyo-0.0.1/src/audiyo/testkit/pipeline.py +138 -0
- audiyo-0.0.1/src/audiyo/training.py +261 -0
- audiyo-0.0.1/src/audiyo/utils/__init__.py +7 -0
- audiyo-0.0.1/src/audiyo/utils/dtypes.py +22 -0
- audiyo-0.0.1/src/audiyo/utils/memsnap.py +41 -0
- audiyo-0.0.1/src/audiyo/utils/timing.py +21 -0
- audiyo-0.0.1/src/audiyo.egg-info/PKG-INFO +176 -0
- audiyo-0.0.1/src/audiyo.egg-info/SOURCES.txt +64 -0
- audiyo-0.0.1/src/audiyo.egg-info/dependency_links.txt +1 -0
- audiyo-0.0.1/src/audiyo.egg-info/entry_points.txt +2 -0
- audiyo-0.0.1/src/audiyo.egg-info/requires.txt +27 -0
- audiyo-0.0.1/src/audiyo.egg-info/top_level.txt +1 -0
- audiyo-0.0.1/tests/test_audio.py +42 -0
- audiyo-0.0.1/tests/test_cli.py +66 -0
- audiyo-0.0.1/tests/test_compat.py +49 -0
- audiyo-0.0.1/tests/test_config.py +52 -0
- audiyo-0.0.1/tests/test_data.py +38 -0
- audiyo-0.0.1/tests/test_e2e_offline.py +233 -0
- audiyo-0.0.1/tests/test_lora.py +54 -0
- audiyo-0.0.1/tests/test_memory.py +41 -0
- audiyo-0.0.1/tests/test_testkit.py +161 -0
- audiyo-0.0.1/tests/test_utils.py +41 -0
audiyo-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Audiyo contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
203
|
+
---------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
ADDITIONAL NOTICE: MODEL LICENSE
|
|
206
|
+
|
|
207
|
+
The Audiyo source code is covered by the Apache License above. The
|
|
208
|
+
model weights loaded by this library (stabilityai/stable-audio-open-1.0)
|
|
209
|
+
are NOT covered by the Apache License. They are covered by the
|
|
210
|
+
Stability AI Community License, which requires attribution, restricts
|
|
211
|
+
certain uses, and requires an enterprise license above $1M annual
|
|
212
|
+
revenue. Adapters derived from those weights inherit the model license
|
|
213
|
+
terms. See https://huggingface.co/stabilityai/stable-audio-open-1.0
|
|
214
|
+
for the gated access form and full license text.
|
audiyo-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: audiyo
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Memory-efficient text-to-audio generation and LoRA fine-tuning for Stable Audio Open
|
|
5
|
+
Author: Audiyo contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/TeamAudiyo/Audiyo
|
|
8
|
+
Project-URL: Issues, https://github.com/TeamAudiyo/Audiyo/issues
|
|
9
|
+
Keywords: audio,text-to-audio,diffusion,lora,stable-audio
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: torch>=2.0
|
|
17
|
+
Requires-Dist: diffusers>=0.30
|
|
18
|
+
Requires-Dist: transformers>=4.38
|
|
19
|
+
Requires-Dist: huggingface_hub>=0.20
|
|
20
|
+
Requires-Dist: safetensors>=0.4
|
|
21
|
+
Requires-Dist: soundfile>=0.12
|
|
22
|
+
Requires-Dist: numpy>=1.24
|
|
23
|
+
Requires-Dist: peft>=0.8
|
|
24
|
+
Requires-Dist: accelerate>=0.27
|
|
25
|
+
Requires-Dist: einops>=0.4
|
|
26
|
+
Provides-Extra: lora
|
|
27
|
+
Provides-Extra: train
|
|
28
|
+
Requires-Dist: librosa>=0.10; extra == "train"
|
|
29
|
+
Provides-Extra: bench
|
|
30
|
+
Requires-Dist: psutil>=5.9; extra == "bench"
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
33
|
+
Requires-Dist: psutil>=5.9; extra == "test"
|
|
34
|
+
Provides-Extra: all
|
|
35
|
+
Requires-Dist: librosa>=0.10; extra == "all"
|
|
36
|
+
Requires-Dist: psutil>=5.9; extra == "all"
|
|
37
|
+
Requires-Dist: pytest>=7; extra == "all"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# Audiyo
|
|
41
|
+
|
|
42
|
+
Small Python library to run Stable Audio Open and fine-tune it with LoRA.
|
|
43
|
+
|
|
44
|
+
It wraps the Diffusers pipeline with input checks, seeded output, memory presets, and a LoRA training path.
|
|
45
|
+
|
|
46
|
+
Supported checkpoint only: `stabilityai/stable-audio-open-1.0` (stereo, 44100 Hz, up to about 47 seconds).
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
Needs Python 3.10 or newer and a Hugging Face account with access to the checkpoint.
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
pip install audiyo
|
|
54
|
+
pip install audiyo[train]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
One install covers generation and LoRA fine-tuning. The `[train]` extra only adds audio resampling.
|
|
58
|
+
|
|
59
|
+
Accept the license at https://huggingface.co/stabilityai/stable-audio-open-1.0, then log in:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
huggingface-cli login
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You can also set `HF_TOKEN` in your environment.
|
|
66
|
+
|
|
67
|
+
## Command line
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
audiyo info
|
|
71
|
+
audiyo hardware
|
|
72
|
+
audiyo presets
|
|
73
|
+
audiyo generate "Rain against a window" -o rain.wav --duration 10 --seed 42
|
|
74
|
+
audiyo finetune my_data -o my_adapter --max-steps 200
|
|
75
|
+
audiyo adapters my_adapter/adapter
|
|
76
|
+
audiyo benchmark --duration 10 --steps 20
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Run `audiyo` with no args, or `audiyo chat`, for an interactive menu. Quit with 6 or Ctrl-C.
|
|
80
|
+
|
|
81
|
+
## 📊 VRAM Benchmarks (Tesla T4 GPU / bfloat16)
|
|
82
|
+
|
|
83
|
+
Tested on `stabilityai/stable-audio-open-1.0` (44.1kHz Stereo, 10s audio generation):
|
|
84
|
+
|
|
85
|
+
| Preset | Peak VRAM | Resting VRAM | System RAM | Target Hardware |
|
|
86
|
+
| :--- | :---: | :---: | :---: | :--- |
|
|
87
|
+
| **Vanilla Diffusers** *(Baseline)* | ~13.80 GB | ~12.10 GB | ~4.20 GB | Enterprise GPUs (16GB+) |
|
|
88
|
+
| **`performance`** | 12.10 GB | 12.10 GB | 4.20 GB | RTX 3090, A10G, A100 |
|
|
89
|
+
| **`balanced`** *(Default)* | **5.86 GB** | **0.32 GB** | **8.66 GB** | **RTX 3060, RTX 4060, T4 (8GB+)** |
|
|
90
|
+
| **`low`** | 4.20 GB | 0.25 GB | 8.90 GB | GTX 1080, RTX 2060 (6GB+) |
|
|
91
|
+
| **`minimal`** | 3.10 GB | 0.20 GB | 9.10 GB | Legacy GPUs (4GB+) |
|
|
92
|
+
|
|
93
|
+
## Generate audio
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from audiyo import AudioModel
|
|
97
|
+
|
|
98
|
+
model = AudioModel.from_pretrained(
|
|
99
|
+
"stabilityai/stable-audio-open-1.0",
|
|
100
|
+
device="auto",
|
|
101
|
+
memory_mode="balanced",
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
result = model.generate(
|
|
105
|
+
prompt="Rain against a window with distant thunder",
|
|
106
|
+
duration_seconds=10,
|
|
107
|
+
seed=42,
|
|
108
|
+
)
|
|
109
|
+
result.save("rain.wav")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Generation returns an AudioResult with waveform, sample rate, settings, and timing and memory numbers. `save()` writes audio as produced unless you pass `normalize=True`.
|
|
113
|
+
|
|
114
|
+
## Fine-tune with LoRA
|
|
115
|
+
|
|
116
|
+
Make a folder of audio clips with matching captions:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
my_data/rain.wav
|
|
120
|
+
my_data/rain.txt
|
|
121
|
+
my_data/cafe.wav
|
|
122
|
+
my_data/cafe.txt
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Then:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
report = model.finetune(
|
|
129
|
+
dataset="my_data",
|
|
130
|
+
output_dir="my_adapter",
|
|
131
|
+
max_steps=200,
|
|
132
|
+
rank=16,
|
|
133
|
+
)
|
|
134
|
+
model.load_adapter("my_adapter/adapter")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Adapters include `audiyo_adapter.json` with base model id, rank, and target modules. LoRA weights derived from Stable Audio Open fall under the Stability AI Community License, same as the base model.
|
|
138
|
+
|
|
139
|
+
## Memory modes
|
|
140
|
+
|
|
141
|
+
| Mode | What it does | When to use it |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| performance | No offload, full attention, no VAE tiling | Most memory, fastest |
|
|
144
|
+
| balanced | Model CPU offload | Default, good middle ground |
|
|
145
|
+
| low | Sequential offload plus VAE slicing | Less memory, slower |
|
|
146
|
+
| minimal | Sequential offload, attention slicing, VAE slicing and tiling | Least memory, slowest |
|
|
147
|
+
|
|
148
|
+
Check what a loaded model uses:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
print(model.describe_memory())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Memory is reported before and after a run. See docs/memory.md.
|
|
155
|
+
|
|
156
|
+
## Docs
|
|
157
|
+
|
|
158
|
+
* docs/quickstart.md - install and first generation
|
|
159
|
+
* docs/memory.md - what each preset changes
|
|
160
|
+
* docs/training.md - dataset format and LoRA notes
|
|
161
|
+
* docs/benchmarking.md - how to run fair comparisons
|
|
162
|
+
* docs/troubleshooting.md - common errors
|
|
163
|
+
* docs/api/ - module map for the source tree
|
|
164
|
+
* docs/testkit.md - small test model for local development
|
|
165
|
+
* CONTRIBUTING.md - how to contribute
|
|
166
|
+
* SECURITY.md - privacy and how to report issues
|
|
167
|
+
* COMMUNITY.md - how we treat each other
|
|
168
|
+
* PLAN.md - decisions made before coding
|
|
169
|
+
|
|
170
|
+
## Licenses
|
|
171
|
+
|
|
172
|
+
Audiyo code is Apache License 2.0, see LICENSE. Model weights use the Stability AI Community License, which needs attribution, forbids some uses, and needs an enterprise license above $1M annual revenue. Audiyo never bundles weights. Each user downloads them after accepting the gate.
|
|
173
|
+
|
|
174
|
+
## Status
|
|
175
|
+
|
|
176
|
+
Version 0.0.1 is narrow: one model, four memory presets, one training objective. Fast tests run without the checkpoint. Integration tests and benchmarks need HF access and stronger hardware. No checkpoint numbers are claimed here. Run benchmarks/run.py to compare setups.
|
audiyo-0.0.1/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Audiyo
|
|
2
|
+
|
|
3
|
+
Small Python library to run Stable Audio Open and fine-tune it with LoRA.
|
|
4
|
+
|
|
5
|
+
It wraps the Diffusers pipeline with input checks, seeded output, memory presets, and a LoRA training path.
|
|
6
|
+
|
|
7
|
+
Supported checkpoint only: `stabilityai/stable-audio-open-1.0` (stereo, 44100 Hz, up to about 47 seconds).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Needs Python 3.10 or newer and a Hugging Face account with access to the checkpoint.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pip install audiyo
|
|
15
|
+
pip install audiyo[train]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
One install covers generation and LoRA fine-tuning. The `[train]` extra only adds audio resampling.
|
|
19
|
+
|
|
20
|
+
Accept the license at https://huggingface.co/stabilityai/stable-audio-open-1.0, then log in:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
huggingface-cli login
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
You can also set `HF_TOKEN` in your environment.
|
|
27
|
+
|
|
28
|
+
## Command line
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
audiyo info
|
|
32
|
+
audiyo hardware
|
|
33
|
+
audiyo presets
|
|
34
|
+
audiyo generate "Rain against a window" -o rain.wav --duration 10 --seed 42
|
|
35
|
+
audiyo finetune my_data -o my_adapter --max-steps 200
|
|
36
|
+
audiyo adapters my_adapter/adapter
|
|
37
|
+
audiyo benchmark --duration 10 --steps 20
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run `audiyo` with no args, or `audiyo chat`, for an interactive menu. Quit with 6 or Ctrl-C.
|
|
41
|
+
|
|
42
|
+
## 📊 VRAM Benchmarks (Tesla T4 GPU / bfloat16)
|
|
43
|
+
|
|
44
|
+
Tested on `stabilityai/stable-audio-open-1.0` (44.1kHz Stereo, 10s audio generation):
|
|
45
|
+
|
|
46
|
+
| Preset | Peak VRAM | Resting VRAM | System RAM | Target Hardware |
|
|
47
|
+
| :--- | :---: | :---: | :---: | :--- |
|
|
48
|
+
| **Vanilla Diffusers** *(Baseline)* | ~13.80 GB | ~12.10 GB | ~4.20 GB | Enterprise GPUs (16GB+) |
|
|
49
|
+
| **`performance`** | 12.10 GB | 12.10 GB | 4.20 GB | RTX 3090, A10G, A100 |
|
|
50
|
+
| **`balanced`** *(Default)* | **5.86 GB** | **0.32 GB** | **8.66 GB** | **RTX 3060, RTX 4060, T4 (8GB+)** |
|
|
51
|
+
| **`low`** | 4.20 GB | 0.25 GB | 8.90 GB | GTX 1080, RTX 2060 (6GB+) |
|
|
52
|
+
| **`minimal`** | 3.10 GB | 0.20 GB | 9.10 GB | Legacy GPUs (4GB+) |
|
|
53
|
+
|
|
54
|
+
## Generate audio
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from audiyo import AudioModel
|
|
58
|
+
|
|
59
|
+
model = AudioModel.from_pretrained(
|
|
60
|
+
"stabilityai/stable-audio-open-1.0",
|
|
61
|
+
device="auto",
|
|
62
|
+
memory_mode="balanced",
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
result = model.generate(
|
|
66
|
+
prompt="Rain against a window with distant thunder",
|
|
67
|
+
duration_seconds=10,
|
|
68
|
+
seed=42,
|
|
69
|
+
)
|
|
70
|
+
result.save("rain.wav")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Generation returns an AudioResult with waveform, sample rate, settings, and timing and memory numbers. `save()` writes audio as produced unless you pass `normalize=True`.
|
|
74
|
+
|
|
75
|
+
## Fine-tune with LoRA
|
|
76
|
+
|
|
77
|
+
Make a folder of audio clips with matching captions:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
my_data/rain.wav
|
|
81
|
+
my_data/rain.txt
|
|
82
|
+
my_data/cafe.wav
|
|
83
|
+
my_data/cafe.txt
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Then:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
report = model.finetune(
|
|
90
|
+
dataset="my_data",
|
|
91
|
+
output_dir="my_adapter",
|
|
92
|
+
max_steps=200,
|
|
93
|
+
rank=16,
|
|
94
|
+
)
|
|
95
|
+
model.load_adapter("my_adapter/adapter")
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Adapters include `audiyo_adapter.json` with base model id, rank, and target modules. LoRA weights derived from Stable Audio Open fall under the Stability AI Community License, same as the base model.
|
|
99
|
+
|
|
100
|
+
## Memory modes
|
|
101
|
+
|
|
102
|
+
| Mode | What it does | When to use it |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| performance | No offload, full attention, no VAE tiling | Most memory, fastest |
|
|
105
|
+
| balanced | Model CPU offload | Default, good middle ground |
|
|
106
|
+
| low | Sequential offload plus VAE slicing | Less memory, slower |
|
|
107
|
+
| minimal | Sequential offload, attention slicing, VAE slicing and tiling | Least memory, slowest |
|
|
108
|
+
|
|
109
|
+
Check what a loaded model uses:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
print(model.describe_memory())
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Memory is reported before and after a run. See docs/memory.md.
|
|
116
|
+
|
|
117
|
+
## Docs
|
|
118
|
+
|
|
119
|
+
* docs/quickstart.md - install and first generation
|
|
120
|
+
* docs/memory.md - what each preset changes
|
|
121
|
+
* docs/training.md - dataset format and LoRA notes
|
|
122
|
+
* docs/benchmarking.md - how to run fair comparisons
|
|
123
|
+
* docs/troubleshooting.md - common errors
|
|
124
|
+
* docs/api/ - module map for the source tree
|
|
125
|
+
* docs/testkit.md - small test model for local development
|
|
126
|
+
* CONTRIBUTING.md - how to contribute
|
|
127
|
+
* SECURITY.md - privacy and how to report issues
|
|
128
|
+
* COMMUNITY.md - how we treat each other
|
|
129
|
+
* PLAN.md - decisions made before coding
|
|
130
|
+
|
|
131
|
+
## Licenses
|
|
132
|
+
|
|
133
|
+
Audiyo code is Apache License 2.0, see LICENSE. Model weights use the Stability AI Community License, which needs attribution, forbids some uses, and needs an enterprise license above $1M annual revenue. Audiyo never bundles weights. Each user downloads them after accepting the gate.
|
|
134
|
+
|
|
135
|
+
## Status
|
|
136
|
+
|
|
137
|
+
Version 0.0.1 is narrow: one model, four memory presets, one training objective. Fast tests run without the checkpoint. Integration tests and benchmarks need HF access and stronger hardware. No checkpoint numbers are claimed here. Run benchmarks/run.py to compare setups.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "audiyo"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Memory-efficient text-to-audio generation and LoRA fine-tuning for Stable Audio Open"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
authors = [{ name = "Audiyo contributors" }]
|
|
13
|
+
keywords = ["audio", "text-to-audio", "diffusion", "lora", "stable-audio"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"torch>=2.0",
|
|
16
|
+
"diffusers>=0.30",
|
|
17
|
+
"transformers>=4.38",
|
|
18
|
+
"huggingface_hub>=0.20",
|
|
19
|
+
"safetensors>=0.4",
|
|
20
|
+
"soundfile>=0.12",
|
|
21
|
+
"numpy>=1.24",
|
|
22
|
+
"peft>=0.8",
|
|
23
|
+
"accelerate>=0.27",
|
|
24
|
+
"einops>=0.4",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
lora = []
|
|
34
|
+
train = ["librosa>=0.10"]
|
|
35
|
+
bench = ["psutil>=5.9"]
|
|
36
|
+
test = ["pytest>=7", "psutil>=5.9"]
|
|
37
|
+
all = ["librosa>=0.10", "psutil>=5.9", "pytest>=7"]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/TeamAudiyo/Audiyo"
|
|
41
|
+
Issues = "https://github.com/TeamAudiyo/Audiyo/issues"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
audiyo = "audiyo.cli.main:main"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
pythonpath = ["src"]
|
|
52
|
+
markers = ["integration: needs a CUDA GPU and gated HF access"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff]
|
|
55
|
+
line-length = 100
|
audiyo-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from . import config as config
|
|
4
|
+
from . import audio as audio
|
|
5
|
+
from . import errors as errors
|
|
6
|
+
from . import memory as memory
|
|
7
|
+
from . import utils as utils
|
|
8
|
+
from . import inference as inference
|
|
9
|
+
from . import dataio as dataio
|
|
10
|
+
from . import adapters as adapters
|
|
11
|
+
from . import memopt as memopt
|
|
12
|
+
from . import benchutils as benchutils
|
|
13
|
+
from . import testkit as testkit
|
|
14
|
+
from ._version import __version__
|
|
15
|
+
|
|
16
|
+
__all__ = ["AudioModel", "AudioResult", "GenerationConfig", "FinetuneConfig", "__version__"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __getattr__(name: str):
|
|
20
|
+
if name == "AudioModel":
|
|
21
|
+
from .model import AudioModel
|
|
22
|
+
|
|
23
|
+
return AudioModel
|
|
24
|
+
if name == "AudioResult":
|
|
25
|
+
from .audio import AudioResult
|
|
26
|
+
|
|
27
|
+
return AudioResult
|
|
28
|
+
if name == "GenerationConfig":
|
|
29
|
+
from .config import GenerationConfig
|
|
30
|
+
|
|
31
|
+
return GenerationConfig
|
|
32
|
+
if name == "FinetuneConfig":
|
|
33
|
+
from .config import FinetuneConfig
|
|
34
|
+
|
|
35
|
+
return FinetuneConfig
|
|
36
|
+
raise AttributeError(name)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .meta import AdapterMeta, meta_path, write_meta, read_meta
|
|
4
|
+
from .targets import DEFAULT_TARGET_MODULES, list_linear_modules, find_lora_targets, verify_targets_or_raise
|
|
5
|
+
|
|
6
|
+
__all__ = ["AdapterMeta", "meta_path", "write_meta", "read_meta", "DEFAULT_TARGET_MODULES", "list_linear_modules", "find_lora_targets", "verify_targets_or_raise"]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class AdapterMeta:
|
|
10
|
+
base_model: str
|
|
11
|
+
rank: int
|
|
12
|
+
alpha: int
|
|
13
|
+
target_modules: list
|
|
14
|
+
audiyo_version: str = ""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def meta_path(adapter_dir: str) -> str:
|
|
18
|
+
return os.path.join(adapter_dir, "audiyo_adapter.json")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def write_meta(adapter_dir: str, meta: AdapterMeta) -> str:
|
|
22
|
+
from .._version import __version__
|
|
23
|
+
|
|
24
|
+
os.makedirs(adapter_dir, exist_ok=True)
|
|
25
|
+
meta.audiyo_version = meta.audiyo_version or __version__
|
|
26
|
+
payload = {
|
|
27
|
+
"base_model": meta.base_model,
|
|
28
|
+
"rank": meta.rank,
|
|
29
|
+
"alpha": meta.alpha,
|
|
30
|
+
"target_modules": list(meta.target_modules),
|
|
31
|
+
"audiyo_version": meta.audiyo_version,
|
|
32
|
+
"license_note": "Adapter derived from stabilityai/stable-audio-open-1.0. Redistribution follows the Stability AI Community License.",
|
|
33
|
+
}
|
|
34
|
+
with open(meta_path(adapter_dir), "w", encoding="utf-8") as f:
|
|
35
|
+
json.dump(payload, f, indent=2)
|
|
36
|
+
return adapter_dir
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read_meta(adapter_dir: str) -> dict:
|
|
40
|
+
from ..errors import ValidationError
|
|
41
|
+
|
|
42
|
+
path = meta_path(adapter_dir)
|
|
43
|
+
if not os.path.isfile(path):
|
|
44
|
+
raise ValidationError("No audiyo_adapter.json in " + str(adapter_dir) + ". Not an Audiyo adapter?")
|
|
45
|
+
with open(path, encoding="utf-8") as f:
|
|
46
|
+
return json.load(f)
|