Audiocraft
audiogen
JadeCopet commited on
Commit
62b7d15
1 Parent(s): 24e8994

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -0
README.md CHANGED
@@ -1,3 +1,46 @@
1
  ---
2
  license: cc-by-nc-4.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-4.0
3
  ---
4
+
5
+ # AudioGen - Medium - 1.5B
6
+
7
+ AudioGen is an autoregressive transformer LM that synthesizes general audio conditioned on text (Text-to-Audio).
8
+ Internally, AudioGen operates over discrete representations learnt from the raw waveform, using an EnCodec tokenizer.
9
+
10
+ AudioGen was presented at [AudioGen: Textually Guided Audio Generation](https://arxiv.org/abs/2209.15352) by *Felix Kreuk, Gabriel Synnaeve, Adam Polyak, Uriel Singer, Alexandre Défossez, Jade Copet, Devi Parikh, Yaniv Taigman, Yossi Adi*.
11
+
12
+ AudioGen 1.5B is a variant of the original AudioGen model that follows [MusicGen](https://arxiv.org/abs/2306.05284) architecture.
13
+ More specifically, it is trained over a 16kHz EnCodec tokenizer with 4 codebooks sampled at 50 Hz with a delay pattern between the codebooks.
14
+ Having only 50 auto-regressive steps per second of audio, this AudioGen model allows faster generation while reaching similar performances to the original AudioGen model introduced in the paper.
15
+
16
+ ## Audiocraft Usage
17
+
18
+ You can run AudioGen locally through the original [Audiocraft library]((https://github.com/facebookresearch/audiocraft):
19
+
20
+ 1. First install the [`audiocraft` library](https://github.com/facebookresearch/audiocraft)
21
+ ```
22
+ pip install git+https://github.com/facebookresearch/audiocraft.git
23
+ ```
24
+
25
+ 2. Make sure to have [`ffmpeg`](https://ffmpeg.org/download.html) installed:
26
+ ```
27
+ apt get install ffmpeg
28
+ ```
29
+
30
+ 3. Run the following Python code:
31
+
32
+ ```py
33
+ import torchaudio
34
+ from audiocraft.models import AudioGen
35
+ from audiocraft.data.audio import audio_write
36
+
37
+ model = AudioGen.get_pretrained('facebook/audiogen-medium')
38
+ model.set_generation_params(duration=5) # generate 8 seconds.
39
+ wav = model.generate_unconditional(4) # generates 4 unconditional audio samples
40
+ descriptions = ['dog barking', 'sirenes of an emergency vehicule', 'footsteps in a corridor']
41
+ wav = model.generate(descriptions) # generates 3 samples.
42
+
43
+ for idx, one_wav in enumerate(wav):
44
+ # Will save under {idx}.wav, with loudness normalization at -14 db LUFS.
45
+ audio_write(f'{idx}', one_wav.cpu(), model.sample_rate, strategy="loudness", loudness_compressor=True)
46
+ ```