DeepStream Reference Application - deepstream-vllm-plugin
The nvvllmvlm plugin is a GStreamer plugin for NVIDIA DeepStream that integrates
Vision-Language Models (VLM) using vLLM for real-time video understanding and analysis.
It enables the integration of vision-language models (Cosmos Reason 2, etc.) into DeepStream
pipelines, processing video frames in configurable time segments and performing batch VLM
inference asynchronously.
The plugin source and reference application are available in the DeepStream mono-repo under
src/apps/reference_apps/deepstream-vllm-plugin.
Key Features
- Segment-based processing: Collects frames into time windows for batch inference.
- Flexible frame sampling: FPS-based or interval-based subsampling.
- Async inference: Background worker thread for non-blocking processing.
- Multi-stream support: One plugin instance handles multiple streams efficiently.
- Per-stream prompts: Different prompts and settings for each stream.
- Configurable models: Supports video-native and image-only VLM models.
- GPU-optimized: Zero-copy GPU operations, with the model shared across streams.
- Flexible input formats: PyTorch tensors, PIL Images, or numpy arrays.
Requirements
- NVIDIA GPU with CUDA support
- NVIDIA DeepStream SDK 9.0.0 or later
- Docker with NVIDIA Container Runtime
- Python 3.12 or later
- vLLM 0.21.0 with PyTorch 2.11.0 (installed by
install.sh) - 40 GB or more of GPU memory
- Currently supported on x86-based GPU platforms
Quick Start
Installation
Launch the DeepStream Triton container and install the plugin dependencies:
Obtain a Hugging Face token
- Log in at https://huggingface.co.
- Go to Profile → Access Tokens.
- Create and save the generated token.
- To use the Cosmos Reason 2 model, go to https://huggingface.co/nvidia/Cosmos-Reason2-8B, review and accept the NVIDIA Open Model License Agreement.
Single-stream and multi-stream processing
Run the following inside the DeepStream container:
Kafka integration
To stream results to Kafka in real time, bring up the Kafka containers on the host (outside the DeepStream container):
Then run the publishing application and consumer inside the DeepStream container:
Configuration
Place config.yaml in the plugin directory or the current working directory. A complete
example follows:
Key settings:
- Video mode:
video_mode: 1uses video metadata (for models with native video support);video_mode: 0uses multi-image mode (image-only models). - Tensor format (image modes only):
pytorch(default),pil, ornumpy. - System prompt: specify a value to use it; omit it for no system prompt; use an empty string to send an empty system prompt.
- Prompt placeholders:
{num_frames}(number of frames in the segment),{stream_id}(stream identifier), and{timestamps}(timestamp string). Include{timestamps}to show timestamps, or omit it to exclude them. - Per-stream prompts: override any inference setting for specific streams; streams without overrides use the global defaults.
Plugin properties
Properties can override the config values at runtime:
Model Support
Video-native models (video_mode: 1): Cosmos-Reason2-8B (default) and other models
with native video-metadata support.
Image-only models (video_mode: 0): models that support image inputs only.
Signal-based results
Access results via GObject signals: