无论是ChatGPT、 LLM大语言模型、还是Meta公司的AI生成音乐,

都需要对 Audio、Video、Bitstream 进行处理。

Text的算法库 SpaCy, numpy, pytorch/Tensorflow/Transformers,…

Audio的算法库 librosa, numpy, pytorch/Tensorflow/Transformers, …;

Image/Video的算法库 Pillow, OpenCV, numpy, pytorch/Tensorflow/Transformers, …;

以Meta(Facebook已改名为Meta)开源的 audiocraft 为例:

  1. ASR(Audio转文本, 人机语音交互与识别)、
  2. TTS(文本合成语音)、
  3. NLP(自然语言处理)、
  4. NLG(自然语言生成)、
  5. Content Generation(智能生成 Text/Image/Audio/Video/…)

audiocraft 的:

  • NLP 部分用的是Python库SpaCy;
  • audio/video 部分用的是Python库 av(用 Cython 封装好FFmpeg C/C++ API),极大的方便 Audio/Video/Bitstream 的上层应用例如 AI/MachinLearning调用.
  • 当然还可以参考Python的 OpenCV / av 库封装其它的多模态内容接口; 实现全媒体覆盖(Article/Text/Image/Audio/Video/…)

SpaCy: Industrial-Strength Natural Language Processing

https://spacy.io/

av 这个库(https://pypi.org/project/av/#description)

FFmpeg: https://ffmpeg.org/documentation.html


PyAV is a Pythonic binding for the [FFmpeg][ffmpeg] libraries.
We aim to provide all of the power and control of the underlying library, but manage the gritty details as much as possible.
PyAV is for direct and precise access to your media via containers, streams, packets, codecs, and frames.
It exposes a few transformations of that data, and helps you get your data to/from other packages (e.g. Numpy and Pillow).
This power does come with some responsibility as working with media is horrendously complicated and PyAV can't abstract it away or make all the best decisions for you.
If the `ffmpeg` command does the job without you bending over backwards, PyAV is likely going to be more of a hindrance than a help.
But where you can't work without it, PyAV is a critical tool.
Installation
------------
Due to the complexity of the dependencies, PyAV is not always the easiest Python package to install from source.
Since release 8.0.0 binary wheels are provided on [PyPI][pypi] for Linux, Mac and Windows linked against a modern FFmpeg.
You can install these wheels by running:
```bash
pip install av
```
If you want to use your existing FFmpeg, the source version of PyAV is on [PyPI][pypi] too:
```bash
pip install av --no-binary av
```
Alternative installation methods
--------------------------------
Another way of installing PyAV is via [conda-forge][conda-forge]:
```bash
conda install av -c conda-forge
```


https://github.com/abaelhe/audiocraft

Audiocraft is a PyTorch library for deep learning research on audio generation. At the moment, it contains the code for MusicGen, a state-of-the-art controllable text-to-music model.

MusicGen

Audiocraft provides the code and models for MusicGen, [a simple and controllable model for music generation][arxiv]. MusicGen is a single stage auto-regressive

Transformer model trained over a 32kHz EnCodec tokenizer with 4 codebooks sampled at 50 Hz. Unlike existing methods like MusicLM, MusicGen doesn't require a self-supervised semantic representation, and it generates

all 4 codebooks in one pass. By introducing a small delay between the codebooks, we show we can predict

them in parallel, thus having only 50 auto-regressive steps per second of audio.

Check out our [sample page][musicgen_samples] or test the available demo!


We use 20K hours of licensed music to train MusicGen. Specifically, we rely on an internal dataset of 10K high-quality music tracks, and on the ShutterStock and Pond5 music data.

Installation

Audiocraft requires Python 3.9, PyTorch 2.0.0, and a GPU with at least 16 GB of memory (for the medium-sized model). To install Audiocraft, you can run the following:

# Best to make sure you have torch installed first, in particular before installing xformers.
# Don't run this if you already have PyTorch installed.
pip install 'torch>=2.0'
# Then proceed to one of the following
pip install -U audiocraft # stable release
pip install -U git+https://git@github.com/facebookresearch/audiocraft#egg=audiocraft # bleeding edge
pip install -e . # or if you cloned the repo locally
</code> <code>
Meta 开源音乐生成模型 MusicGen
2023-06-18 10:18 104 Meta 近日在 Github 上开源了其音乐生成模型 MusicGen。据介绍,MusicGen 主要用于音乐生成,它可以将文本和已有的旋律转化为完整乐曲。该模型基于谷歌 2017 年推出的 Transformer 模型。 研发团队表示:“我们使用了 20000 小时的授权音乐来训练该模型,并采用 Meta 的 EnCodec 编码器将音频数据分解为更小的单元进行并行处理,进而让 MusicGen 的运算效率和生成速度都比同类型 AI 模型更为出色。” 除此之外,MusicGen 还支持文本与旋律的组合输入,例如你可以提出生成 “一首轻快的曲目” 并同时要求 “将它与贝多芬的《欢乐颂》结合起来”。 研发团队还对 MusicGen 的实际表现进行了测试。结果显示,与谷歌的 MusicLM 以及 Riffusion、Mousai、Noise2Music 等其他音乐模型相比,MusicGen 在测试音乐与文本提示的匹配度以及作曲的可信度等指标上表现更好,总体而言略高于谷歌 MusicLM 的水平。 Meta 已允许该模型的商业使用,并在 Huggingface 上发布了一个供演示用的网页应用。 延伸阅读 谷歌推出 MusicLM,从文本生成音乐的模型
</code>

LLM多模态•audiocraft•av(interfacing FFmpeg API)•Audio/Video/Bitstream•pytorch•sklearn•numpy•pandas•spacy•librosa•opencv的更多相关文章

  1. [转载] FFmpeg API 变更记录

    最近一两年内FFmpeg项目发展的速度很快,本来是一件好事.但是随之而来的问题就是其API(接口函数)一直在发生变动.这么一来基于旧一点版本的FFmpeg的程序的代码在最新的类库上可能就跑不通了. 例 ...

  2. FFmpeg API 变更记录

    最近一两年内FFmpeg项目发展的速度很快,本来是一件好事.但是随之而来的问题就是其API(接口函数)一直在发生变动.这么一来基于旧一点版本的FFmpeg的程序的代码在最新的类库上可能就跑不通了. 例 ...

  3. ffmpeg api升级到3.3 api变化

     void av_free_packet(AVPacket * pkt) Use void av_packet_unref(AVPacket * pkt) Wipe the packet. Unref ...

  4. 学习FFmpeg API

    ffmpeg是编解码的利器,用了很久,以前看过dranger 的教程,非常精彩,受益颇多,是学习ffmpeg api很好的材料.可惜的是其针对的ffmpeg版本已经比较老了,而ffmpeg的更新又很快 ...

  5. 【转】学习FFmpeg API – 解码视频

    ffmpeg是编解码的利器,用了很久,以前看过dranger 的教程,非常精彩,受益颇多,是学习ffmpeg api很好的材料.可惜的是其针对的ffmpeg版本已经比较老了,而ffmpeg的更新又很快 ...

  6. Expo大作战(二十六)--expo sdk api之Video和WebBrowser

    简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...

  7. [jPlayer] HTML5 Audio & Video for jQuery

    ---------------------------------------------------------------------------------------------------- ...

  8. with ffmpeg to encode video for live streaming and for recording to files for on-demand playback

    We've been doing some experimentation with ffmpeg to encode video for live streaming and for recordi ...

  9. 使用HTML5抓取 Audio & Video

    原文地址: http://www.html5rocks.com/en/tutorials/getusermedia/intro/ 本地化的文章: http://www.html5rocks.com/z ...

  10. The jQuery HTML5 Audio / Video Library (jQuery jPlayer插件给你的站点增加视频和音频功能)

    http://jplayer.org/ The jQuery HTML5 Audio / Video Library jPlayer is the completely free and open s ...

随机推荐

  1. stackbd:在一个块设备上堆叠另一个块设备

    stackbd 是一个虚拟的块设备,它作为另一个块设备的前端,如 USB 闪存盘或循环设备.它将I/O请求传递给底层设备,同时它打印请求信息用于调试.它还有可能修改请求. 堆叠块设备(stackbd) ...

  2. 使用Linux筛选文本-日志分析

    用于简单的文本筛选和日志分析还是很方便的. 我这里用的kali **目的:**筛选出test文件中 状态码为500的url 命令: cat test |grep '500' >test1 或 g ...

  3. python相关函数

    1.pow()函数 pow()函数解释 pow(x,y):表示x的y次幂. >>> pow(2,4) 16 >>> pow(x,y,z):表示x的y次幂后除以z的余 ...

  4. Sentinel——pull模式规则持久化

    目录 pull模式规则持久化 定义数据源 定义SPI接口文件 测试 pull模式规则持久化 pull 模式的数据源(如本地文件.RDBMS 等)一般是可写入的.使用时需要在客户端注册数据源:将对应的读 ...

  5. 下载mysql-connector-java-8.*.*.jar

    各个版本mysql驱动jar包下载:http://central.maven.org/maven2/mysql/mysql-connector-java/ 直达下载链接:https://dev.mys ...

  6. 【HUST】代数学|理想的分解习题

    以下内容中,背景知识部分尽数由GPT生成,生成的方式是直接对问题进行提问,存在错误的小节我已经标注,不保证不存在其他错误. 习题部分是GPT生成后,我将看不懂的地方自己重写了一遍的结果.不保证完全正确 ...

  7. 【笔记】Git|将git仓库中所有的 commit 合成一个,清空所有 git 提交记录

    在对代码进行开源时,我们往往并不希望代码开发过程中的提交记录被其他人看到,因为提交的过程中往往会涵盖一些敏感信息.因此会存在 将仓库中所有 commit 合成一个 的需求. 直觉上,往往会用 reba ...

  8. C# 利用反射模拟多态效果

    public class A { } public class B : A { } public class C : A { } public static class Extension { pub ...

  9. odoo18运行报错问题解决

    File "/Users/melon/.pyenv/versions/3.11.9/lib/python3.11/code.py", line 90, in runcode exe ...

  10. 面试题:java Runnable与Callable 的区别

    相同点 都是接口:(废话,当然是接口了) 都可用来编写多线程程序: 都需要调用Thread.start()启动线程. Callable是类似于Runnable的接口,实现Callable接口的类和实现 ...