How kaist-ailab/syncvsr works
And Represent the Main Components
• Data Preparation & Preprocessing:
• “Video Dataset Preparation” pipeline. This includes:
▪ Downloading data (using wget commands for LRW, LRS datasets).
▪ Preprocessing pipelines (files like preprocess_roi.py, preprocess_pkl.py in both LRS/video and LRW/video).
▪ Tokenized audio files (external audio-tokens downloaded from releases, with example code that loads pickle files).
• Configuration & Setup:
• “config” directories found in both LRS/video and LRW/video (as well as LRW/landmark). These YAML and shell script files are used to specify training, inference, and model hyperparameters.
• Additional setup scripts such as setup.sh in various places that configure dependencies.
• Data Module & Dataloader:
• LRW’s similar source data components (e.g., dataset.py in LRW/landmark/src and LRW/video/src/data.py).
• Model Architecture:
• The model is built using PyTorch along with custom layers for the encoder and a special linear projection (audio_projection) that synchronizes visual data with quantized audio tokens.
▪ The Encoder: That processes video frames (with special tokens for non-autoregressive predictions) to generate latent representations.
▪ The Audio Projection Module: Shown as an explicit block that projects encoder outputs into the space of distributed audio tokens. Indicate its role in producing logits for audio reconstruction.
▪ Loss Components: Visual Speech Recognition (VSR) objectives (Word classification, CTC, LM loss) combined with an audio reconstruction loss scaled by a factor λ_audio.
• Use of architectures borrowed from the “espnet” folder, which contains multiple ASR components (e.g., beam_search, transformer encoder/decoder layers, and scorer interfaces).
• Training & Inference Pipeline:
• Two training and inference flows:
▪ Sentence-Level VSR (LRS): “main.py”, “lightning.py” in LRS/video that run training and evaluation using lrs2.yaml and lrs3.yaml configurations.
▪ Word-Level VSR (LRW): “train.py”, “inference.py” within LRW/video along with corresponding configs (e.g., bert-12l-512d_LRW_96_bf16_rrc_WB.yaml).
▪ For the LRW/landmark branch, add its own training pipeline where different network configurations are used (see the transformer config scripts).
• External Dependencies & Additional Tools:
• Use of external libraries and frameworks such as PyTorch (and potentially lightning for training orchestration), fairseq (for optional audio quantization), ffmpeg, and additional system libraries.
• How quantized audio tokens are incorporated either by pre-downloaded tokens or by running the wav2vec quantizer.
Relationships and Data Flow
• From preprocessing, flow data into the datamodule (for both video and audio).
• Interaction Points:
• Where configurations from YAML files feed into model training/inference, ensuring that dynamic parameters are adjustable.
• How external tokenized audio files are loaded and integrated into the data pipeline, and highlight fast paths for inference versus full training.
Architectural Patterns & Design Principles
• Modular Design:
• Use of separation of concerns (for example, model definition vs. dataloader vs. configuration), which makes the system extensible.
• End-to-End Pipeline:
• Geometry should highlight the end-to-end nature of the system, starting with raw video and audio data, applying preprocessing, passing through a specialized VSR model, and ending with loss computation/training updates.