Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:OpenGVLab InternVL Classification Config

From Leeroopedia


Knowledge Sources
Domains Configuration, Classification, Vision Transformer
Last Updated 2026-02-07 14:00 GMT

Overview

Defines the full hierarchical configuration schema for the InternVL classification pipeline using YACS CfgNode, covering data loading, model architecture, training hyperparameters, augmentation, and testing settings.

Description

This module builds a CfgNode tree (_C) with default values for all configuration parameters organized into logical sections:

  • DATA -- Batch size, image size, interpolation method, dataset paths, zip mode, caching, and data loading workers.
  • MODEL -- Model type and name, pretrained weights, number of classes, dropout rates, and architecture-specific sub-configs for InternViT-6B (patch size, embed dim 3200, 25 heads, 48 layers, QK normalization, flash attention, RMS norm) and CLIP-ViT (patch size, embed dim 1024, 16 heads, 24 layers).
  • TRAIN -- Epochs, warmup, weight decay, base/warmup/min learning rates, gradient clipping, auto-resume, accumulation steps, gradient checkpointing, LR scheduler (cosine/linear/step), optimizer (AdamW/SGD with ZeRO support), EMA, and layer-wise LR decay.
  • AUG -- Color jitter, AutoAugment, random erase, Mixup, CutMix with configurable probabilities and modes.
  • TEST -- Center crop and sequential sampler options.

The _update_config_from_file function recursively merges YAML config files supporting BASE inheritance chains. The update_config function overlays command-line arguments onto the loaded config and computes the output directory path before freezing the config. get_config returns a cloned and populated config object.

Usage

Use this module to initialize and manage configuration for classification experiments. All training scripts call get_config(args) to obtain a frozen config object that serves as the single source of truth for data loading, model construction, optimizer setup, scheduler creation, and evaluation.

Code Reference

Source Location

Signature

def _update_config_from_file(config, cfg_file): ...

def update_config(config, args): ...

def get_config(args) -> CfgNode: ...

Import

from classification.config import get_config

I/O Contract

Inputs

Name Type Required Description
args argparse.Namespace Yes Command-line arguments containing cfg (path to YAML config file) and optional overrides (batch_size, data_path, resume, etc.)

Outputs

Name Type Description
config CfgNode Frozen hierarchical configuration object with all experiment parameters

Usage Examples

Basic Usage

from classification.config import get_config

# args.cfg points to a YAML configuration file
config = get_config(args)

# Access nested config values
batch_size = config.DATA.BATCH_SIZE
base_lr = config.TRAIN.BASE_LR
embed_dim = config.MODEL.INTERN_VIT_6B.EMBED_DIM

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment