|
| 1 | +# Configuration System |
| 2 | + |
| 3 | +`flyvis` uses [Hydra](https://hydra.cc/) for configuration management of network and training. The configuration system is organized hierarchically, allowing for modular configuration of different components. |
| 4 | + |
| 5 | +## Configuration Components |
| 6 | + |
| 7 | +### Configuration Components |
| 8 | + |
| 9 | +#### Network Configuration |
| 10 | + |
| 11 | +* `network/`: Core network architecture and parameters |
| 12 | +* `connectome/`: Neural connectivity specification |
| 13 | +* `dynamics/`: Neural dynamics parameters |
| 14 | +* `edge_config/`: Synapse-related configurations (sign, strength, count) |
| 15 | +* `node_config/`: Neuron-related configurations (bias, time constants) |
| 16 | +* `stimulus_config/`: Input stimulus parameters |
| 17 | + |
| 18 | +#### Training Configuration |
| 19 | + |
| 20 | +* `optim/`: Optimization parameters |
| 21 | +* `penalizer/`: Loss function penalties |
| 22 | +* `scheduler/`: Learning rate scheduling |
| 23 | +* `task/`: Task-specific settings and parameters |
| 24 | + |
| 25 | +#### Top-level Configuration |
| 26 | +* `solver.yaml`: Training loop parameters |
| 27 | + |
| 28 | + |
| 29 | +## Default Configuration Structure |
| 30 | + |
| 31 | +The default configuration is structured as follows: |
| 32 | + |
| 33 | +```bash |
| 34 | +config |
| 35 | +├── network # Network configuration |
| 36 | +│ ├── connectome # Connectome configurations |
| 37 | +│ │ └── connectome.yaml # Default connectome configuration |
| 38 | +│ ├── dynamics # Dynamics configurations |
| 39 | +│ │ └── dynamics.yaml # Default dynamics configuration |
| 40 | +│ ├── edge_config # Edge configuration |
| 41 | +│ │ ├── edge_config.yaml # Default edge configuration |
| 42 | +│ │ ├── sign # Signaling configurations |
| 43 | +│ │ │ └── sign.yaml # Default signaling configuration |
| 44 | +│ │ ├── syn_count # Synaptic count configurations |
| 45 | +│ │ │ └── syn_count.yaml # Default synaptic count configuration |
| 46 | +│ │ └── syn_strength # Synaptic strength configurations |
| 47 | +│ │ └── syn_strength.yaml # Default synaptic strength configuration |
| 48 | +│ ├── network.yaml # Default network configuration |
| 49 | +│ ├── node_config # Node configuration |
| 50 | +│ │ ├── bias # Bias configurations |
| 51 | +│ │ │ └── bias.yaml # Default bias configuration |
| 52 | +│ │ ├── node_config.yaml # Default node configuration |
| 53 | +│ │ └── time_const # Time constant configurations |
| 54 | +│ │ └── time_const.yaml # Default time constant configuration |
| 55 | +│ └── stimulus_config # Stimulus configuration |
| 56 | +│ └── stimulus_config.yaml # Default stimulus configuration |
| 57 | +├── optim # Optimizer configuration |
| 58 | +│ └── optim.yaml # Default optimizer configuration |
| 59 | +├── penalizer # Penalizer configuration |
| 60 | +│ └── penalizer.yaml # Default penalizer configuration |
| 61 | +├── scheduler # Scheduler configuration |
| 62 | +│ └── scheduler.yaml # Default scheduler configuration |
| 63 | +├── solver.yaml # Default solver configuration |
| 64 | +└── task # Task configuration |
| 65 | + └── task.yaml # Default task configuration |
| 66 | + |
| 67 | +15 directories, 16 files |
| 68 | +``` |
| 69 | + |
| 70 | +## Customizing Configurations |
| 71 | + |
| 72 | +### Overriding Default Parameters |
| 73 | + |
| 74 | +For quick parameter changes you can use hydra command-line overrides. |
| 75 | + |
| 76 | +```bash |
| 77 | +# Example: Change the scale of the synaptic strength to 0.5 |
| 78 | +flyvis train-single network.edge_config.syn_strength.scale=0.5 ensemble_and_network_id=0042/007 task_name=flow |
| 79 | + |
| 80 | +# Example: Add a custom parameter to an existing config |
| 81 | +flyvis train-single +network.edge_config.syn_strength.custom_param=100 ensemble_and_network_id=0042/007 task_name=flow |
| 82 | +``` |
| 83 | + |
| 84 | +More information on hydra command-line overrides can be found [here](https://hydra.cc/docs/advanced/override_grammar/basic/). |
| 85 | + |
| 86 | +### Using Custom Configurations |
| 87 | + |
| 88 | +In many situations you will want to create custom configuration files, to either break |
| 89 | +the existing config structure for new code or to keep track of different sets of parameters. |
| 90 | + |
| 91 | +This particularly applies when installing `flyvis` as a package instead of using the |
| 92 | +developer mode, where one can directly modify the source code configuration. |
| 93 | + |
| 94 | +To create and maintain your own configuration files proceed as follows: |
| 95 | + |
| 96 | +1. Initialize a local config directory: |
| 97 | + |
| 98 | + ```bash |
| 99 | + # Copy the default config structure into flyvis_config |
| 100 | + flyvis init-config |
| 101 | + ``` |
| 102 | + |
| 103 | +2. Create your custom configurations in the generated `flyvis_config` directory. |
| 104 | + |
| 105 | +3. Use your custom configs: |
| 106 | + |
| 107 | + ```bash |
| 108 | + # Using the full custom config directory |
| 109 | + flyvis train-single --config-path $(pwd)/flyvis_config [other options] |
| 110 | +
|
| 111 | + # Using a specific custom config |
| 112 | + flyvis train-single network/edge_config/syn_strength=custom_syn_strength --config-dir $(pwd)/flyvis_config |
| 113 | + ``` |
| 114 | + |
| 115 | + Notice that **`config-path`** overrides the entire default config directory, while **`config-dir`** only adds another search path for resolving configs. |
| 116 | + |
| 117 | + **Important:** It is recommended to use different file names than the defaults. |
| 118 | + This is because for partial usage with `config-dir` hydra resolves the config names in the default config directory first. I.e., your changes reflected in files of the same name in the custom config directory might not have the intended effect. E.g., name your config file `custom_syn_strength.yaml` instead of `syn_strength.yaml`. |
| 119 | + |
| 120 | + |
| 121 | +More information on hydra configuration can be found [here](https://hydra.cc/docs/advanced/search_path/). |
0 commit comments