Аудио РУКОВОДСТВО ПО ИИ

МузыкаГен

MusicGen is Meta's open-weight text-to-music model, published in June 2023, that writes music as a sequence of compressed audio tokens using a single transformer language model.

Прослушайте это руководствоОзвучено ИИ · ~8 min

На этой странице9 минут чтения
  1. Обзор
  2. Ключевые выводы
  3. Глубокое погружение
  4. Generating and checking a short MusicGen clip
  5. Реальная реализация
  6. Будущее MusicGen
  7. Применение на практике
  8. Источники и дальнейшее чтение
  9. Продолжайте исследовать
  10. Часто задаваемые вопросы

Обзор

It can follow a text description such as a genre and mood, or a hummed or played melody, and outputs 32 kHz audio. Its code is MIT-licensed, while its weights are licensed for non-commercial use.

Ключевые выводы

  1. MusicGen is a single-stage transformer that generates EnCodec audio tokens from a text description and, optionally, a melody.
  2. Meta released MusicGen weights and code as part of AudioCraft on 2 August 2023.
  3. MusicGen was trained on about 20,000 hours of licensed music and comes in 300M, 1.5B and 3.3B parameter sizes.
  4. The delay interleaving pattern turns 30 seconds of four-codebook audio into about 1,500 autoregressive steps.
  5. MusicGen cannot produce realistic vocals, because vocals were removed from its training data.
  6. MusicGen code is MIT-licensed, but its model weights are CC-BY-NC 4.0, which prohibits commercial use.

Глубокое погружение

MusicGen is a model that generates music from a text description, optionally guided by a melody. It was introduced by Jade Copet and colleagues at Meta AI in the paper "Simple and Controllable Music Generation", first posted to arXiv in June 2023. It works the way a text language model does, predicting the next token from the previous ones, except that its tokens represent short slices of compressed audio rather than words. A separate neural audio codec turns those tokens back into sound. The word simple in the title refers to the design: one transformer generates everything in a single stage, instead of the chain of models that earlier systems such as Google's MusicLM used to go from coarse to fine detail.

The first ingredient is EnCodec, a neural audio codec from the same Meta team, described in an October 2022 paper. A codec compresses audio into a compact form and reconstructs it. The MusicGen version takes 32 kHz mono audio, downsamples it by a stride of 640 samples to 50 frames per second, and represents each frame with residual vector quantization (RVQ): four codebooks of 2,048 entries each, where the first codebook captures the coarse content and each later codebook encodes what the previous ones missed. Thirty seconds of music therefore becomes 1,500 frames, each with four tokens.

The second ingredient is how those four parallel token streams are fed to one transformer. Predicting all 6,000 tokens of a 30-second clip one by one, called flattening, is accurate but slow. Predicting all four codebooks of a frame at once, called parallel, is fast but ignores dependencies between them. MusicGen's default "delay" pattern offsets each codebook by one step, so at each step the model predicts codebook 1 for the current frame, codebook 2 for the previous frame, and so on. The paper says this turns 30 seconds of audio into 1,500 autoregressive steps. In its ablation, flattening still scored best, delay came close, and parallel was worst.

Conditioning steers the generation. Text prompts are encoded by a frozen T5 text encoder, and the paper also tested FLAN-T5 and CLAP. For melody, the model reads a chromagram, a representation of how much energy falls in each of the 12 pitch classes over time. The authors found that the raw chromagram led the model to copy the original track, so they kept only the dominant pitch class at each step and used Demucs, a source-separation model, to remove drums and bass first, because those dominated the chromagram. Generation uses classifier-free guidance: during training the condition is dropped 20% of the time, and at inference the model blends conditioned and unconditioned predictions with a guidance scale of 3.0 to follow the prompt more closely.

Training used about 20,000 hours of licensed music: an internal set of 10,000 high-quality tracks plus 25,000 and 365,000 instrument-only tracks from the ShutterStock and Pond5 collections, all at 32 kHz with text descriptions and metadata. The team trained models of 300 million, 1.5 billion and 3.3 billion parameters for one million steps on 30-second crops, using 32, 64 and 96 GPUs respectively. Meta announced the model publicly on 2 August 2023 as part of AudioCraft, alongside AudioGen for sound effects and an improved EnCodec decoder. The Hugging Face model card says the version 1 models were trained between April and May 2023.

On the MusicCaps benchmark of expert-written music descriptions, MusicGen compared well. Frechet Audio Distance (FAD), which measures how far generated audio statistics are from real audio, was 3.1 for the 300M model, against 4.0 reported for MusicLM, 7.5 for Mousai and 14.8 for Riffusion; Noise2Music reported the best FAD at 2.1. In human ratings on a 1 to 100 scale, the 3.3B model scored 84.81 for overall quality and the 1.5B model 83.70 for relevance to the text, against 80.51 and 82.35 for the public MusicLM demo. The authors note that larger models did not always improve automatic metrics even when listeners preferred them. With melody conditioning, the similarity between the reference and generated chromagrams rose from 0.10 to 0.66. A stereo variant, fine-tuned from the mono model with eight codebooks, was rated higher than mono.

Compared with alternatives, MusicGen's main trade is simplicity for some control. Hierarchical systems like MusicLM cascade several models, which the MusicGen authors avoided. Diffusion-based systems such as Riffusion and Mousai generate spectrograms or latents through iterative denoising rather than token by token. Within token-based models, MusicGen's interleaving patterns are its distinguishing choice. Its open release is also a difference: Meta published weights and code, while MusicLM's implementation was not public at the time of the paper.

The limitations are stated by Meta itself. The model card says MusicGen cannot generate realistic vocals, because vocals were removed from training data; works best with English descriptions; performs unevenly across musical styles and cultures; sometimes collapses to silence at the end of a song; and may need prompt engineering. The paper's authors note that their method offers no fine-grained control over how closely the output follows the conditioning beyond classifier-free guidance, and that the dataset contains a larger proportion of Western-style music. They also raise the concern that generative models could compete unfairly with artists. The weights are licensed CC-BY-NC 4.0, which rules out commercial use, even though the code is MIT-licensed. In practice, running MusicGen requires Python, PyTorch and ffmpeg per the AudioCraft README, and a GPU is advisable for the larger checkpoints; the model card's examples generate clips of a few seconds at a time.

04Рабочий пример

Generating and checking a short MusicGen clip

  1. Install Hugging Face Transformers version 4.31.0 or later and scipy, and confirm the use is non-commercial under the CC-BY-NC 4.0 weight license.

  2. Load facebook/musicgen-small through the text-to-audio pipeline to keep memory use low for a first test.

  3. Generate a clip from the prompt 'lo-fi hip hop beat with soft piano and vinyl crackle' and save the returned 32 kHz array as a WAV file.

  4. Generate a second clip from the same prompt and listen to both; sampling with top-k makes each run different.

  5. Change one element of the prompt, such as swapping piano for saxophone, and check whether the instrumentation changes accordingly.

  6. Compare with the melody checkpoint by supplying a short reference melody and listening for whether the tune carries over.

Что это показывает

Two or more short instrumental clips at 32 kHz that reflect the prompt's genre and instruments. Check them by listening for prompt adherence, for any collapse to silence near the end, and by noting that no realistic vocals appear, both of which match the limitations in Meta's model card.

Реальная реализация

Meta released MusicGen with AudioGen and EnCodec as the AudioCraft framework on 2 August 2023, publishing model weights and training code so researchers could train models on their own data.

Melody conditioning: the MusicGen melody checkpoint extracts a chromagram from a reference track after removing drums and bass, then generates new music that follows that tune while matching a text prompt.

Researchers load the small, medium, large or melody checkpoints through Hugging Face Transformers (version 4.31.0 or later) with the text-to-audio pipeline to produce mono 32 kHz clips.

In the paper's listening tests on MusicCaps, the 3.3B-parameter MusicGen scored 84.81 out of 100 for overall quality, above the 80.51 measured for the public MusicLM demo.

The AudioCraft repository later added related research models such as MAGNeT, a non-autoregressive text-to-music model, and AudioSeal for audio watermarking, built on the same codebase.

Будущее MusicGen

The MusicGen paper names its own open problems: finer control over how strictly output follows its conditioning, and better data augmentation and guidance for audio conditioning such as melodies. Meta's August 2023 announcement acknowledged that the training data skews toward Western-style music and English-only descriptions, which limits the model's range. Since 2023, the AudioCraft repository has grown to include MAGNeT, a non-autoregressive text-to-music and text-to-sound model, MusicGen Style, JASCO for conditioning on chords, melodies and drum tracks, and AudioSeal for watermarking generated audio, which shows the research direction toward faster generation, richer musical controls and provenance tools. Questions about training-data licensing, attribution and the economic effect on working musicians remain unresolved across the field, and the MusicGen authors flagged unfair competition for artists as an open issue. Evaluations using shared benchmarks such as MusicCaps, together with human listening tests, remain the main way to compare newer music models with MusicGen.

Применение на практике

Почему это важно

  • Доступ и охват. Это улучшает доступность за счет транскрипции, повествования и голосовых интерфейсов.
  • Стоимость и бюджет. Медиа-команды могут выпускать качественное аудио быстрее с меньшими бюджетами.
  • Скорость и масштаб. Системы, работающие с клиентами, могут обрабатывать устные взаимодействия в большем масштабе.

Следите за

  • Риски неправильного использования голоса и выдачи себя за другое лицо возрастают при отсутствии согласия.
  • Точность может снижаться из-за акцентов, диалектов или шумной обстановки.
  • Синтетический звук можно принять за аутентичную речь без четкой маркировки.

Следующие шаги

  1. Получите явное согласие на захват, клонирование и повторное использование голоса.
  2. Проверьте качество звука при использовании различных динамиков и фоновых условий.
  3. Определите, когда человек должен проверять или утверждать результаты.
  4. Маркируйте синтетический звук и сохраняйте записи о происхождении для обеспечения ответственности.

Источники и дальнейшее чтение

  1. arXiv (Meta AI)Simple and Controllable Music Generation
  2. GitHub (facebookresearch)AudioCraft: Open source code for audio generation
  3. Hugging Facefacebook/musicgen-large model card
  4. Meta AIAudioCraft: A simple one-stop shop for audio modeling
  5. arXiv (Meta AI)High Fidelity Neural Audio Compression

Продолжайте исследовать

Бесплатная рассылка

Получайте ежедневный AI-обзор

Три проверенных AI-истории каждое утро буднего дня, написанные простым английским. Бесплатно навсегда, без рекламы.

Одно электронное письмо каждый будний день. Отписаться в один клик. Мы никогда не продаем и не передаем ваш адрес.

Проверьте себя

Take the MusicGen quiz

Мгновенная обратная связь по каждому ответу и общий сертификат с проверяемым идентификатором после прохождения курса.

Начать тест

Поддержите бесплатное образование в области искусственного интеллекта. AI Understanding — это некоммерческая организация 501(c)(3). Никакой рекламы и платного доступа. Сделать пожертвование

Часто задаваемые вопросы

Что такое MusicGen?

MusicGen is Meta's open-weight text-to-music model, published in June 2023, that writes music as a sequence of compressed audio tokens using a single transformer language model. It can follow a text description such as a genre and mood, or a hummed or played melody, and outputs 32 kHz audio. Its code is MIT-licensed, while its weights are licensed for non-commercial use.

Which input can a melody-conditioned MusicGen variant accept in addition to text?

The melody-conditioned variant can use a text description and a reference melody; this input is not available in every text-only checkpoint.

Какой нейронный кодек создает аудиотокены, прогнозируемые MusicGen?

MusicGen моделирует дискретные токены, генерируемые кодеком EnCodec Meta, который также декодирует предсказанные токены обратно в аудио.

How does MusicGen model multiple EnCodec code streams?

The architecture uses delayed interleaving in a single-stage autoregressive model; “single-stage” does not mean the whole song is generated in one forward pass.

Как MusicGen следует предоставленной мелодии, не копируя точную запись?

Хромаграмма фиксирует, какие классы высоты звука присутствуют с течением времени, позволяя MusicGen сопоставлять гармонию и контур мелодии, не воспроизводя исходный тембр.

Какой проект и компания выпустили MusicGen?

MusicGen был выпущен в 2023 году как часть проекта Meta AI AudioCraft с открытым кодом и весами моделей.

Продолжайте учиться

Связанные руководства

Другие руководства, выбранные по этой теме

Получите бесплатный AI-сертификатКороткий бесплатный курс и экзамен. Без стоимости, без карты. Около 2,5 часов.Начать бесплатно →