Files
wehub-resource-sync d7d51fdafd
audiocraft_docs / Run docs (push) Has been cancelled
audiocraft_linter / Run linter (push) Has been cancelled
audiocraft_tests / Run tests (push) Has been cancelled
docs: make Chinese README the default
2026-07-13 10:35:11 +00:00

5.0 KiB

Note

本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
English · 原始项目 · 上游 README
原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。

AudioCraft

docs badge linter badge tests badge

AudioCraft 是一个用于音频生成深度学习研究的 PyTorch 库。AudioCraft 包含用于两个最先进(state-of-the-art)AI 生成模型的高质量音频推理和训练代码:AudioGen 和 MusicGen。

安装

AudioCraft 需要 Python 3.9 和 PyTorch 2.1.0。要安装 AudioCraft,可以运行以下命令:

# Best to make sure you have torch installed first, in particular before installing xformers.
# Don't run this if you already have PyTorch installed.
python -m pip install 'torch==2.1.0'
# You might need the following before trying to install the packages
python -m pip install setuptools wheel
# Then proceed to one of the following
python -m pip install -U audiocraft  # stable release
python -m pip install -U git+https://git@github.com/facebookresearch/audiocraft#egg=audiocraft  # bleeding edge
python -m pip install -e .  # or if you cloned the repo locally (mandatory if you want to train).
python -m pip install -e '.[wm]'  # if you want to train a watermarking model

我们还建议安装 ffmpeg,可通过系统或 Anaconda 安装:

sudo apt-get install ffmpeg
# Or if you are using Anaconda or Miniconda
conda install "ffmpeg<5" -c conda-forge

模型

目前,AudioCraft 包含以下模型的训练代码和推理代码:

  • MusicGen:最先进的可控文本到音乐(text-to-music)模型。
  • AudioGen:最先进的文本到音效(text-to-sound)模型。
  • EnCodec:最先进的高保真神经音频编解码器。
  • Multi Band Diffusion:使用扩散(diffusion)的、与 EnCodec 兼容的解码器。
  • MAGNeT:用于文本到音乐和文本到音效的最先进非自回归(non-autoregressive)模型。
  • AudioSeal:最先进的音频水印(audio watermarking)。
  • MusicGen Style:最先进的文本与风格到音乐(text-and-style-to-music)模型。
  • JASCO:"基于和弦、旋律和鼓轨条件的高质量文本到音乐模型"

训练代码

AudioCraft 包含用于音频深度学习研究的 PyTorch 组件,以及已开发模型的训练流水线。 有关 AudioCraft 设计原则的一般介绍以及开发自定义训练流水线的说明,请参阅 AudioCraft 训练文档

若要复现现有工作并使用已开发的训练流水线,请参阅各具体模型的说明,其中提供了配置、示例网格以及模型/任务特定信息和常见问题解答的指引。

API 文档

我们为 AudioCraft 提供了部分 API 文档

常见问题

训练代码是否可用?

是的!我们提供了 EnCodecMusicGenMulti Band DiffusionJASCO 的训练代码。

模型存储在哪里?

Hugging Face 将模型存储在特定位置,可通过为 AudioCraft 模型设置 AUDIOCRAFT_CACHE_DIR 环境变量来覆盖该位置。 若要更改其他 Hugging Face 模型的缓存位置,请参阅 Hugging Face Transformers 缓存设置文档. 最后,如果你使用的模型依赖 Demucs(例如 musicgen-melody),并希望更改 Demucs 的下载位置,请参阅 Torch Hub 文档.

许可证

  • 本仓库中的代码根据 LICENSE 文件 中所载的 MIT 许可证发布。
  • 本仓库中的模型权重根据 LICENSE_weights 文件 中所载的 CC-BY-NC 4.0 许可证发布。

引用

若引用 AudioCraft 的一般框架,请引用以下内容。

@inproceedings{copet2023simple,
    title={Simple and Controllable Music Generation},
    author={Jade Copet and Felix Kreuk and Itai Gat and Tal Remez and David Kant and Gabriel Synnaeve and Yossi Adi and Alexandre Défossez},
    booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
    year={2023},
}

引用特定模型时,请按各模型专属 README 中的说明进行引用,例如 ./docs/MUSICGEN.md./docs/AUDIOGEN.md 等。