File size: 3,855 Bytes
e4924ca
1b58c2f
 
 
 
 
 
 
 
 
 
 
e4924ca
1b58c2f
 
 
 
 
 
 
e4924ca
 
1b58c2f
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
 
 
 
 
 
1b58c2f
 
 
e4924ca
1b58c2f
 
e4924ca
1b58c2f
 
e4924ca
1b58c2f
e4924ca
1b58c2f
 
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
1b58c2f
 
 
e4924ca
1b58c2f
 
 
e4924ca
416504a
e4924ca
1b58c2f
 
e4924ca
 
1b58c2f
 
 
 
 
 
 
 
e4924ca
 
1b58c2f
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
 
 
1b58c2f
e4924ca
 
 
 
1b58c2f
e4924ca
 
 
 
1b58c2f
 
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
1b58c2f
e4924ca
 
1b58c2f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
language:
- en
- ar
- de
- es
- fr
- it
- ja
- pt
- ru
license: mit
library_name: transformers
datasets:
- fixie-ai/librispeech_asr
- fixie-ai/common_voice_17_0
- fixie-ai/peoples_speech
- fnlp/AnyInstruct
metrics:
- bleu
---

# Model Card for Ultravox

Ultravox is a multimodal Speech LLM built around a pretrained [Llama3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B) and [Whisper-medium](https://huggingface.co/openai/whisper-medium) backbone.

See https://ultravox.ai for the GitHub repo and more information.


## Model Details

### Model Description

Ultravox is a multimodal model that can consume both speech and text as input (e.g., a text system prompt and voice user message). 
The input to the model is given as a text prompt with a special `<|audio|>` pseudo-token, and the model processor will replace this magic token with embeddings derived from the input audio.
Using the merged embeddings as input, the model will then generate output text as usual. 

In a future revision of Ultravox, we plan to expand the token vocabulary to support generation of semantic and acoustic audio tokens, which can then be fed to a vocoder to produce voice output.
No preference tuning has been applied to this revision of the model.

- **Developed by:** Fixie.ai
- **License:** MIT

### Model Sources

- **Repository:** https://ultravox.ai
- **Demo:** See repo

## Usage

Think of the model as an LLM that can also hear and understand speech. As such, it can be used as a voice agent, and also to do speech-to-speech translation, analysis of spoken audio, etc.

To use the model, try the following:
```python
# pip install transformers peft librosa

import transformers
import numpy as np
import librosa

pipe = transformers.pipeline(model='fixie-ai/ultravox-v0_4', trust_remote_code=True)

path = "<path-to-input-audio>"  # TODO: pass the audio here
audio, sr = librosa.load(path, sr=16000)


turns = [
  {
    "role": "system",
    "content": "You are a friendly and helpful character. You love to answer questions for people."
  },
]
pipe({'audio': audio, 'turns': turns, 'sampling_rate': sr}, max_new_tokens=30)
```


## Training Details

The model uses a pre-trained [Llama3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B) backbone as well as the encoder part of [Whisper-medium](https://huggingface.co/openai/whisper-medium).

Only the multi-modal adapter is trained, while Whisper encoder and Llama are kept frozen.

We use a knowledge-distillation loss where Ultravox is trying to match the logits of the text-based Llama backbone.

### Training Data

Training dataset is a mix of ASR datasets, extended by adding a "continuation" generated by Llama 3.1 8B.


### Training Procedure

Supervised speech to audio finetuning. For more info, see [training code in Ultravox repo](https://github.com/fixie-ai/ultravox/blob/main/ultravox/training/train.py).


#### Training Hyperparameters

- **Training regime:** BF16 mixed precision training
- **Hardward used:** 8x H100 GPUs

#### Speeds, Sizes, Times

The current version of Ultravox, when invoked with audio content, has a time-to-first-token (TTFT) of approximately 150ms, and a tokens-per-second rate of ~50-100 when using an A100-40GB GPU, all using a Llama 3.1 8B backbone.

Check out the audio tab on [TheFastest.ai](https://thefastest.ai/?m=audio) for daily benchmarks and a comparison with other existing models.

## Evaluation
|                   | en_de (BLEU) | es_en (BLEU) | LibriSpeech clean.test (WER) |
|:------------------|:-------------|:-------------|:----------------------------|
| Ultravox v0.3 | 22.66        | 24.74        | 6.67                        |
| **Ultravox v0.4** | **25.47**        | **37.11**        | **4.45**                        |
| Llama3.1 (text-only) | 31.95     | 38.28        | -                           |