Cosmos-Embed1 (video embedding)
Role in VSS
The Real-Time Embedding microservice (Real-Time Embedding) loads Cosmos-Embed1 variants by default (for example 224p / 336p / 448p Hugging Face checkpoints) and publishes video and text embeddings for semantic search and Kafka consumers. The updated model card also includes a 448p anomaly-detection variant fine-tuned with LoRA. Container variables such as MODEL_PATH, optional MODEL_IMPLEMENTATION_PATH, and Triton repo scripts are described under Customizations on Real-Time Embedding.
Full TAO reference for Cosmos-Embed1—including experiment schema tables, dataset configs, and optional Weights & Biases logging—lives in the published embedding chapter and mirrors the in-repo tlt-docs/docs/text/embedding/cosmos_embed1.rst (and cosmos_embed1_tables.rst) sources.
Architecture and tasks
Cosmos-Embed1 is a dual-encoder video–text model: an EVA-ViT-G visual encoder on sampled frames, a Q-Former distilled from video features, a BERT-style text encoder, and CLIP-style or SigLIP-style contrastive alignment. Each forward pass runs in either text-encoding mode or video-encoding mode and produces a normalized embedding in a shared vector space. LoRA is supported for efficient fine-tuning of visual and Q-Former attention layers.
TAO tasks:
Where <action> is one of train, evaluate, inference, or export.
Model variants
The current Cosmos-Embed1 model card lists these checkpoints:
The checkpoints default to their optimized square resolution, but the model card notes that arbitrary non-square resolutions are supported. If you switch between 224p and the 336p/448p variants, plan to re-index vector stores because the embedding dimension changes from 256 to 768.
Hardware requirements
Minimum (typical single-GPU training at 224p): one NVIDIA GPU with at least 40 GB GPU memory; Ubuntu 20.04+; CUDA 12.1+.
Recommended: multiple A100 or H100 GPUs, fast storage for video I/O, and sufficient CPU cores for dataloaders. Exact needs depend on resolution, batch size, and train.max_iter.
Data input (summary)
Cosmos-Embed1 uses a JSON or JSONL metadata file mapping each video to a caption (and optional labels). The dataset_type field selects loaders. Common types include:
Field-level requirements (paths, caption_field, chunking) are in the Cosmos-Embed1 TAO chapter. Align your frame sampling and resolution with the variant you deploy. The model card reports optimization around 8 frames, typically sampled at 1-2 FPS; confirm the production chunking in your runtime config.
TAO fine-tuning configuration
Fine-tuning uses YAML experiment files that follow the ExperimentConfig schema. Full parameter tables live in the published Cosmos-Embed1 chapter; they are generated from tlt-docs/docs/text/embedding/cosmos_embed1_tables.rst.
Top-level sections in the experiment file:
results_dir— run output rootwandb— optional Weights & Biases loggingmodel—pretrained_model_path,precision,input_hw,network(EVA-ViT, Q-Former, frames, resolution, contrastive type),lora,fsdpdataset—train_dataset,val_dataset,test_dataset,inference_dataset(each aSingleDatasetConfigwithdataset_type,metadata,data_root, batching, etc.)train—max_iter,num_gpus,optim,loss_weights,callbacks,ema, resume paths,freeze_visual_encoder, …evaluate— checkpoint, callbacks (top-K, UMAP), optional embedding cache pathsinference— checkpoint, query config,k, corpus cache pathsexport—mode(video/text/combined/ Hugging Face),onnx_file,opset_version,hf_output_dir
Example experiment specification
Illustrative 224p layout (vad_r1-style metadata). Replace ?? with your paths; align network.num_video_frames and dataset.*.num_video_frames with deployment. When available, start from the packaged cosmos_embed1/configs/experiment_specs/*.yaml files in your TAO Toolkit tree and merge overrides rather than authoring a spec from scratch.
LoRA fine-tuning (config fragment)
Use a LoRA spec (for example finetune_224p_lora.yaml in the TAO starter layouts) and ensure the visual encoder allows PEFT injection (transformer_engine: false on the visual encoder when required by the TAO release):
Launch model fine-tuning
Update dataset paths and training budget, then run:
Checkpoints are written under <results_dir>/train/ (for example cosmos_embed1_model_latest.pth).
Evaluate the fine-tuned model
Optional: set evaluate.save_dataset_pkl / evaluate.load_dataset_pkl to cache embeddings between runs.
Run inference (text / video search)
Use inference.save_dataset_pkl / inference.load_dataset_pkl to cache the encoded corpus.
Export ONNX and Hugging Face
ONNX — export.mode selects video, text, combined, or Hugging Face export paths:
Hugging Face layout (for drop-in MODEL_PATH):
Integrating fine-tuned weights into RT-Embedding
- Fine-tune with TAO using resolution and sampling that match production (chunk length, frame count, variant).
- Export to ONNX or Hugging Face layout as required by your runtime.
- Set
MODEL_PATHto agit:Hugging Face URL or a mounted local directory with the expected structure. If you change the Python implementation or Triton repository layout, setMODEL_IMPLEMENTATION_PATHandMODEL_REPOSITORY_SCRIPT_PATHconsistently with Real-Time Embedding. - Re-index Elasticsearch (or other vector stores) if embedding dimension or semantics change; rerun integration tests for RTSP ingest, file ingest, and Kafka consumers.
For embedding search and agent workflows, see Search and Model customization overview.
Source material in this repo’s doc trees
tlt-docs/docs/text/embedding/cosmos_embed1.rst— full narrative, commands, and configurationtlt-docs/docs/text/embedding/cosmos_embed1_tables.rst— generated parameter tablestlt-docs/docs/text/embedding/index.rst— embedding overview and launcher pattern