How do-not-circulate/genni works
Main Components
– Experiment management (experiment.py)
– Data getters (data_getters.py) to handle data extraction for experiments.
– Training logic (training.py, training_utils.py)
– Model-related functionality (nets and their definitions in genni/nets)
– Griding functionality (in genni/griding/…) for grid creation, interpolation and statistics.
– Save/Load utilities, along with other helper functions (utils.py)
• Experiment Scripts and Configuration:
– The entry point for running experiments is in the “scripts/experiment.py” file.
– The configuration file “genni.yml” (along with pyproject.toml, setup.py) is used to define settings such as the GENNI_HOME directory.
• Experiment Storage and Outputs:
– The experiments folder (with subdirectories like FCN_Sample and LeNet_Sample) holds all the training artifacts – model snapshots (.pt files), logs, and post-processing results. Inside each experiment directory, you have “models”, “runs”, and “postprocessing” structure.
• Postprocessing and Plotting:
– The “notebooks” folder (e.g., SubspaceAnalysis.ipynb) and the “postprocessing” subdirectories under both FCN_Sample and LeNet_Sample offer insight into visualization, grid computation, and analysis of the learned equivalence classes.
• Testing and Deployment:
– While minimal, the “tests” directory signals that some test routines exist to verify functionality.
Relationships and Data Flow
• User/Experimenter launches a run by invoking “scripts/experiment.py” (or through pip installed package interface) using the configuration provided in “genni.yml.”
• The experiment script leverages the core library (genni) to load data (via data_getters) and define the network architecture (via nets).
• Training is conducted using routines found in training.py and training_utils.py. During training, model snapshots and logs are saved under the experiments directory (organized by timestamp and experimental ID).
• The griding module (located in genni/griding) performs analyses on the trained model’s parameter space. It uses interpolation and statistics methods to compute the equivalence classes’ geometry.
• The overall data flow is: Configuration & Input Data → Experiment Runner (scripts) → Core GENNI Modules (training, griding, nets, utilities) → Experiment Outputs (models, logs, grid data) → Visualization (notebooks and plotting scripts).
Architectural Patterns and Design Principles
• Modular Design: The project separates concerns by grouping experiment logic, neural network definitions, training routines, griding/interpolation functionality, and utilities into different modules.
• Configurability: Use of configuration files (genni.yml) makes the experiments flexible.
• Separation of Experiment and Analysis: The use of a dedicated experiments output directory and separate notebooks/postprocessing routines emphasizes a clear boundary between computation and visualization.
• Reusability: The core library is structured so that new experiments, architectures, or visualization methods can be added without needing to change the core workflow.