Skip to main content
LFM3-Omni is a single end-to-end model that understands text, images, video, and audio, and answers in text, speech, or interleaved text and speech. One small model replaces a separate speech recognition model, vision-language model, LLM, and text-to-speech model. The examples below use LFM3-Omni-2B with Transformers. They cover:
  • Speech: recognition, synthesis, speech-to-text translation, and spoken chat
  • Images: captioning and visual question answering, asked in text or by voice, answered in text or speech
  • Video: questions about a clip, using the frames alone or the frames and their soundtrack
  • Audio understanding: open-ended and multiple-choice questions about a recording
  • Tool calling: function calls from an image and a spoken request
  • Output control: let the model choose its output modality, or force text, speech, or interleaved output
For speech-only workloads, see Audio Capabilities.

Setup

Install Transformers and the packages used by the examples. torchcodec decodes video and the soundtrack of a video. A GPU is recommended; the model runs in bfloat16.
The processor bundles the tokenizer, the image, video, and audio preprocessors, and the audio codec (processor.audio_tokenizer), which turns generated speech codes into a 24 kHz waveform.

Helper

Every example below is a chat conversation. The helper renders it, loading any image, video, or audio it names, then generates and returns the text reply and the speech, if any. The model chooses its output modality itself, guided by the system prompt. Pass generation_mode="text", "audio", or "interleaved" to force one. Text output is greedy. Speech uses audio_temperature=0.4, audio_repetition_penalty=1.2, and audio_repetition_window=64. These are also the defaults in the model’s generation_config.json; the helper passes them explicitly to keep the examples reproducible.

Speech

Text-to-speech

Use the system prompt Perform TTS in {language} using a {female|male} voice. and pass generation_mode="audio". For English, say American English or British English. Supported languages: English (American and British), Arabic, Chinese, Danish, Dutch, Finnish, French, German, Greek, Hebrew, Italian, Japanese, Korean, Polish, Portuguese, Spanish, Swedish, and Turkish.

Speech recognition

Use the system prompt Perform ASR in {language}. Pass audio in the user turn as {"type": "audio", "audio": <path or URL>}. It’s resampled to 16 kHz mono on load.
Output

Speech translation

LFM3-Omni translates speech into text. Translation works best into or out of English. Name the source and target languages in the system prompt, for example Convert the speech in {source} to written {target}. or Please translate the following spoken {source} into {target} text. The model was trained on many phrasings, so pick the one that works best for your data.
Output

Spoken chat

Use the system prompt Respond with interleaved text and audio. The model answers with text and speech interleaved, so speech can start playing before the full answer is written. The question can be text or speech. Keep the system prompt exactly as shown, and give any further instructions in the user turn.
Output (text part; the speech is saved to reply.wav)
For plain text chat, use no system prompt, or Respond with text.
Output

Images

Images are processed at their native resolution. Recommended system prompts: Describe the provided image. for captions, and Answer questions about the provided image. Base every answer only on what can be seen. for questions.
Output Input photo
The question can also be asked by voice, with the recording in place of the text. This example uses the spoken question from the text-to-speech example. When the answer should be in a different modality from the question, add an output instruction after the task prompt, for example Respond with text.
Output
Or ask in text and get a spoken answer:
Output (text part; the speech is saved to bee_answer.wav)

Video

Video is sampled at 2 frames per second. Consecutive frames are paired, and each pair is prefixed with its timestamp. Use the system prompt Answer questions about the video using what you see and hear. To include the soundtrack, pass load_audio_from_video=True and use_audio_in_video=True. The processor reads the video’s audio track and interleaves it with the frames, so each pair of frames is followed by the sound that goes with it.
Output (frames only)

Audio understanding

Open-ended questions about sounds, music, and speech need no system prompt: put the audio and the question in the user turn.
Output
For multiple choice, use the system prompt Answer questions about the provided audio clip. Base every answer only on what can be heard. and end the user turn with Please choose the answer from the options.
Output

Tool calling

This example shows the model a restaurant photo and asks by voice to book a table. The model reads the restaurant name from the sign and combines it with the city, date, time, party size, and reservation name from the spoken request. The example only prints the proposed call and doesn’t make a reservation. Pass the book_table schema to apply_chat_template() with tools=.... The model returns the call between <tool_call> and </tool_call>.
Output Café de Flore, Paris Photo: Café de Flore, Paris by ayustety, CC BY-SA 2.0.
Your application parses and executes the call and returns the result as a tool message. See Tool Use for the full workflow.

Output modality

generation_mode overrides the output modality the model would choose on its own. Use generation_mode="audio" (speech only) for reading text aloud. For open-ended answers, prefer "interleaved". This example answers the same question in text and in interleaved text and speech:
Output

FAQ

When should I use LFM3-Omni-2B instead of LFM3-Audio-2B? Use LFM3-Omni-2B when a request involves images or video, such as spoken questions about a photo or questions about a video and its soundtrack. For speech-only workloads, use LFM3-Audio-2B. What input formats are supported? Audio files are resampled to 16 kHz mono on load. Images are processed at their native resolution. Video is sampled at 2 frames per second. Speech output is a 24 kHz waveform. Does the model reason before answering? No. LFM3-Omni-2B is a non-reasoning model.