--- license: other language: - en tags: - audio - video - image - audio-visual - multimodal - reasoning - video understanding - long-video - audio understanding - ASR - timestamp-grounding - instruction-tuned - dynamic-s2 - CRTE - TAVIT pipeline_tag: video-text-to-text library_name: transformers --- # Model Overview
Audio-Visual Flamingo

Audio-Visual Flamingo: Open Audio-Visual Intelligence for Long and Complex Videos

Project Page GitHub GitHub stars Transformers fork
Checkpoint Gradio Demo AV-Skills TAVIT
Audio-Visual Flamingo (AVF) is a fully open audio-visual large language model for joint understanding and reasoning over audio, images, and videos. `nvidia/audio-visual-flamingo-hf` is the instruction-tuned checkpoint for multimodal understanding and text generation over long, complex, real-world videos. AVF is designed for settings where the answer depends on both what is visible and what is audible: speech, background sounds, music, visual actions, scene transitions, temporal order, and cross-modal alignment. This checkpoint is text-output only. The broader AVF system includes a streaming TTS component, but speech output is not part of this checkpoint. **This model is for non-commercial research purposes only.** ## Description AVF extends the Audio Flamingo line from audio-only understanding into joint audio-visual reasoning. The model combines: - a SigLIP vision tower for images and sampled video frames - Dynamic-S2 visual preprocessing for high-resolution images and long videos - an AF-Whisper audio encoder for speech, sound, and music - separate 2-layer projectors for visual and audio features - temporal audio-visual interleaving with Constrained Rotary Time Embeddings (CRTE) - a Qwen2.5-7B-family decoder-only language backbone Unlike systems that process video frames and audio as independent streams, AVF aligns synchronized visual and audio chunks, interleaves them along the time axis, and feeds the fused sequence to the language model. This helps the model attend across co-occurring visual and auditory events. ## Model Details - **Developed by:** NVIDIA and University of Maryland - **Model type:** audio-visual large language model for conditional text generation - **Backbone:** Qwen2.5-7B-family decoder-only language model - **Modalities:** text, image, audio, video - **Language:** English-focused release - **License:** NVIDIA OneWay Noncommercial License ## Model Sources - **Checkpoint:** https://huggingface.co/nvidia/audio-visual-flamingo-hf - **Demo:** https://huggingface.co/spaces/nvidia/audio-visual-flamingo - **Project page:** https://avflamingo.github.io/ - **Audio Flamingo repository:** https://github.com/NVIDIA/audio-flamingo - **Transformers integration fork:** https://github.com/lashahub/transformers/tree/add_AudioVisualFlamingo ## Best For - video question answering where both audio and visual evidence matter - detailed audio-visual captioning for real-world videos - temporal reasoning over event order, scene changes, and long-range context - audio-visual event alignment, such as identifying which sound matches a visual moment - reasoning over speech, environmental sounds, music, and visual actions together - image, audio, video, and text prompts in a single chat-template interface ## Usage ### Install AVF support is currently available through the AVF Transformers integration fork while the upstream Transformers PR is pending. ```bash pip install --upgrade pip pip install "transformers[video] @ git+https://github.com/lashahub/transformers.git@add_AudioVisualFlamingo" pip install accelerate torch torchaudio librosa soundfile ``` For video and audio decoding, make sure `ffmpeg` and `libsndfile1` are available in your system environment. ### Notes - Use `load_audio_in_video=True` when a video file should contribute both sampled frames and its audio track. - The processor expects audio at `16 kHz` mono internally and extracts `128`-bin log-mel features. - Audio is processed in `30`-second windows. - The released processor defaults to `num_video_frames=32`; examples below use `128` frames for stronger video coverage. - AVF is trained for long videos up to `15` minutes and `32K` context in long-context stages. Very long, dense videos can still be challenging. - Prompting matters. Ask explicitly for audio-visual evidence, timestamps, scene transitions, speech, sounds, or temporal order when those details matter. ### Video + Audio From One Container ```python import torch from transformers import AudioVisualFlamingoForConditionalGeneration, AutoProcessor model_id = "nvidia/audio-visual-flamingo-hf" dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32 model = AudioVisualFlamingoForConditionalGeneration.from_pretrained( model_id, device_map="auto", dtype=dtype, load_audio_in_video=True, ).eval() processor = AutoProcessor.from_pretrained( model_id, padding_side="left", use_fast=False, load_audio_in_video=True, num_video_frames=128, audio_chunk_length="max_3600", ) conversation = [ { "role": "user", "content": [ {"type": "video", "video": "/path/to/video.mp4"}, { "type": "text", "text": ( "Describe the full video. Include the visual scene, spoken content, " "important sounds or music, and how the audio and visuals align over time." ), }, ], } ] inputs = processor.apply_chat_template( conversation, tokenize=True, add_generation_prompt=True, return_dict=True, ).to(model.device) generated_ids = model.generate( **inputs, max_new_tokens=1024, do_sample=False, ) new_tokens = generated_ids[:, inputs["input_ids"].shape[1] :] print(processor.batch_decode(new_tokens, skip_special_tokens=True)[0]) ``` ### Image, Audio, Video, and Text Items AVF uses one chat-template interface for all modalities: ```python conversation = [ { "role": "user", "content": [ {"type": "image", "image": "/path/to/reference_frame.jpg"}, {"type": "audio", "path": "/path/to/audio.wav"}, {"type": "video", "video": "/path/to/video.mp4"}, { "type": "text", "text": "What does the audio reveal that is not obvious from the image and video frames alone?", }, ], } ] ``` ### Prompt Guide | Task | Prompt pattern | | --- | --- | | Detailed AV captioning | `Generate a detailed caption of the full video, covering both visual events and the audio track.` | | Audio-visual alignment | `Explain how the audio and visuals align over time. Mention key timestamps or scene transitions.` | | Temporal order | `Arrange the major audio-visual events in chronological order and explain the evidence.` | | Spoken-content analysis | `Transcribe the speech, identify speakers if possible, and relate the speech to the visual scene.` | | Sound-grounded QA | `What sound occurs when the camera shows , and what visual evidence supports it?` | | Visual-grounded audio QA | `Which visible action best explains the sound heard around