How zhangzm0128/dvt works
Main Components
• Configurations: The “configs” directory (e.g., DVT_cifar10.json) holds settings that customize the training or test modes.
• Execution Layer: The main scripts (main.py, train.py, test.py) serve as entry points. They parse command-line arguments, load configurations, and invoke training or testing routines.
• Network/Model Architecture: The “network” directory contains key modules such as the Vision Transformer (vision_transformer.py), core neural network logic (network.py), loss functions (loss.py), and additional modules like SPT for specialized operations.
• Utilities: The “utils” folder includes helper modules for data augmentation (data_aug.py), data loading (dataloader.py), logging (logger.py), and miscellaneous utility functions.
• Logs: The “logs” directory serves as a repository for runtime logs and experiment outputs.
• External Dependencies: Built on PyTorch and inspired by dendritic learning and Vision Transformers.
Relationships and Interactions
• The configuration files (configs/) feed into the main scripts (main.py) which control whether the application runs in train or test mode.
• During training, main.py uses the utility modules (utils/) to prepare the data and logs progress, while the actual model operations (forward/backward passes) are managed by modules in the network directory.
• The network modules interact with each other: the vision_transformer.py module is central to defining the transformer-based architecture, while network.py and net_utils.py might combine various building blocks. The loss function in loss.py captures the model’s performance during training.
• The overall data and control flow moves from config parameters to data loading (via utils/dataloader.py and utils/data_aug.py), then to the network for feature extraction and prediction, and finally to logging/metrics (via utils/logger.py) which are stored in logs/.
Important Architectural Patterns
• Clear Separation of Concerns: Configurations, model definitions, and utility functions are maintained in distinct directories.
• Modular Design: The network builds on the idea of modular components (e.g., independent vision transformer, dendritic learning modules, and loss computation).
• Reusability and Extensibility: Utility modules and separate network components allow for easy modifications, testing, and extension of the model’s capabilities.