How internrobotics/streamvln works
Purpose and Entry Points
StreamVLN is an online vision-and-language navigation system: it consumes continuous visual observations plus navigation instructions and emits action tokens in a multi-turn dialogue loop. Primary workflows are training (streamvln/streamvln_train.py), simulation evaluation (streamvln/streamvln_eval.py), DAgger collection (streamvln/streamvln_dagger.py), trajectory generation (streamvln/streamvln_trajectory_generation.py), and real-world serving (streamvln/http_realworld_server.py).
Streaming Navigation Agent
streamvln/streamvln_agent.py is the runtime controller between an environment/robot and the model. It maintains the observation/action dialogue state, requests incremental model outputs, and feeds emitted actions back to navigation. streamvln/model/stream_video_vln.py adapts the Video-LLM for StreamVLN’s slow-fast context behavior: fast streaming context uses a sliding-window KV cache, while slow memory is updated through token pruning.
Multimodal Model Stack
The vendored LLaVA stack provides the base multimodal architecture and model loading boundary. llava/model/llava_arch.py integrates image/video features with language-model token streams; llava/model/builder.py constructs checkpoints, tokenizers, and processors; llava/model/language_model/llava_qwen.py is a supported Qwen language-model backend. Conversation formatting and image/token handling are centralized in llava/conversation.py and llava/mm_utils.py.
Vision Encoding and Token Adaptation
Visual frames cross a distinct encoder-to-language boundary. Encoder selection is dispatched by llava/model/multimodal_encoder/builder.py, with CLIP/EVA/Hugging Face, SigLIP, ImageBind, and related implementations available. Encoded visual tokens are resized or filtered by resamplers such as llava/model/multimodal_resampler/perceiver.py and llava/model/multimodal_resampler/masked_drop.py, then mapped into the LLM embedding space by llava/model/multimodal_projector/builder.py. This is the principal place where token-budget and slow-memory mechanisms can be shaped.
Data and Training Pipelines
Navigation trajectories are loaded from observation/action annotations by streamvln/dataset/vln_action_dataset.py; general interleaved multimodal co-training uses streamvln/dataset/mmc4_dataset.py. Stage-one and stage-two training are configured through config/vln_r2r.yaml and config/co-training_data.yaml, with distributed launch wrappers in scripts/streamvln_train_slurm.sh and scripts/streamvln_stage_two_train_slurm.sh. Core LLaVA optimization behavior is supplied by llava/train/llava_trainer.py; DPO-related paths are available through llava/train/train_dpo.py and the local trl/ package.
Simulation, Evaluation, and Demonstrations
Habitat is the simulator/runtime dependency for VLN-CE episodes and MP3D/HM3D scenes. Evaluation drives the agent over simulator episodes and records navigation measures via streamvln/streamvln_eval.py and streamvln/habitat_extensions/measures.py. DAgger collection executes policy rollouts to produce additional image/action supervision in streamvln/streamvln_dagger.py; generated trajectories feed later training stages.
Serving and Real-World Boundary
For physical deployment, realworld/go2_vln_client.py connects model decisions to a Unitree Go2-oriented client, while realworld/pid_controller.py converts high-level movement intent into control behavior. streamvln/http_realworld_server.py exposes the model side over HTTP. This boundary separates GPU Python inference from robot transport/control and should preserve action validation, latency handling, and safety behavior.
Runtimes and External Assets
The intended runtime is Python 3.9, PyTorch 2.1.2, CUDA 12.4, plus Habitat-Sim/Habitat-Lab for simulation. Checkpoints and datasets are external, notably Hugging Face-hosted StreamVLN weights and trajectory data; required scene data are Matterport3D and HM3D. Multi-node/multi-GPU execution is expected through Slurm scripts and distributed helpers in streamvln/utils/dist.py.
Main entry points: streamvln_train.py Training entry point · streamvln_agent.py Streaming navigation agent · stream_video_vln.py Stream video VLN model · llava_arch.py LLaVA multimodal architecture
Components 21
Streaming model
Online multimodal inference and token adaptation.
- Streaming navigation agent · Maintains dialogue state and returns incremental navigation actions.
streamvln/streamvln_agent.py - Stream video VLN model · Uses sliding-window KV cache and pruned slow memory.
streamvln/model/stream_video_vln.py - LLaVA multimodal architecture · Combines visual features with language-model token streams.
llava/model/llava_arch.py - Vision encoder selection · Selects CLIP, EVA, SigLIP, ImageBind, or Hugging Face encoders.
llava/model/multimodal_encoder/builder.py - Visual token resampler · Resizes or filters encoded visual tokens.
llava/model/multimodal_resampler/perceiver.py - Multimodal projector · Maps visual tokens into the LLM embedding space.
llava/model/multimodal_projector/builder.py - Qwen language backend
llava/model/language_model/llava_qwen.py - Model loader · Constructs checkpoints, tokenizers, and processors.
llava/model/builder.py
Data and training
Supervision, optimization, and distributed training.
- Training entry point
streamvln/streamvln_train.py - Training configs · Defines stage-one VLN and stage-two co-training inputs.
config/vln_r2r.yaml - Slurm launchers
scripts/streamvln_train_slurm.sh - Distributed helpers
streamvln/utils/dist.py - VLN action dataset · Loads observation and action annotations.
streamvln/dataset/vln_action_dataset.py - Interleaved multimodal data
streamvln/dataset/mmc4_dataset.py - LLaVA trainer
llava/train/llava_trainer.py
Simulation and evaluation
Habitat-based rollout, evaluation, and data collection.
- Simulation evaluation · Runs episodes and records navigation metrics.
streamvln/streamvln_eval.py - DAgger collection · Produces additional image/action supervision.
streamvln/streamvln_dagger.py - Habitat measures
streamvln/habitat_extensions/measures.py
Real-world serving
HTTP inference boundary and robot control.
- Real-world HTTP server · Separates GPU inference from robot transport.
streamvln/http_realworld_server.py - Go2 robot client
realworld/go2_vln_client.py - PID controller · Converts high-level movement intent into control behavior.
realworld/pid_controller.py
Connections 21
- Slurm launchers → Training entry point: launches
- Training configs → Training entry point: configures
- Distributed helpers → Training entry point: distributes
- VLN action dataset → Training entry point: supervision
- Interleaved multimodal data → Training entry point: co-training data
- Training entry point → LLaVA trainer: optimizes with
- LLaVA trainer → Stream video VLN model: trains
- Model loader → Stream video VLN model: loads weights
- Streaming navigation agent → Stream video VLN model: requests outputs
- Stream video VLN model → LLaVA multimodal architecture: adapts
- Vision encoder selection → Visual token resampler: visual tokens
- Visual token resampler → Multimodal projector: reduced tokens
- Multimodal projector → LLaVA multimodal architecture: visual embeddings
- Qwen language backend → LLaVA multimodal architecture: language backbone
- Simulation evaluation → Streaming navigation agent: drives episodes
- Simulation evaluation → Habitat measures: records
- DAgger collection → Streaming navigation agent: policy rollouts
- DAgger collection → VLN action dataset: adds trajectories
- Real-world HTTP server → Streaming navigation agent: serves inference
- Go2 robot client → Real-world HTTP server: action requests
- Go2 robot client → PID controller: movement intent