ExperimentConfig
Dataclass containing all experiment parameters for edge AI hardware optimization. Includes training settings, hardware constraints, and optimization configurations.Fields
Random seed for reproducibility across all random number generators.
Dataset name. Supported values:
"mnist", "fashion-mnist".Batch size for training and validation data loaders.
Number of training epochs.
Learning rate for the optimizer.
Maximum number of training samples to use.
None uses the full training set.Maximum number of validation samples to use.
None uses the full validation set.Power budget constraint in watts for edge device simulation.
List of pruning ratios to evaluate (e.g.,
[0.0, 0.3, 0.5] for 0%, 30%, 50% pruning).List of numeric precisions to evaluate (e.g.,
["fp32", "fp16", "int8"]).Number of batches to use for quantization calibration.
Directory path for saving experiment results and artifacts.
List of memory budget constraints in megabytes to evaluate.
Active memory budget in megabytes for runtime constraints.
CPU frequency scaling factor (e.g.,
0.8 for 80% of max frequency).Seed for data loader shuffling. Defaults to
seed if not specified in config file.Number of worker processes for data loading. Defaults to
2 if not specified.Number of times to repeat benchmarks for averaging. Defaults to
5 if not specified.Memory bandwidth in GB/s for hardware simulation. Defaults to
12.8 if not specified.load_config
Loads and parses experiment configuration from a text file format.Path to the configuration file. Accepts string paths or
pathlib.Path objects.Parsed configuration object with all experiment parameters.
Configuration File Format
The configuration file uses a simplekey: value format:
- Lines starting with
#are comments - Empty lines are ignored
- Each line contains a key-value pair separated by
: - Lists use bracket notation:
[item1, item2, item3] - Supports automatic type inference for strings, integers, floats, booleans, null values, and lists
Supported Value Types
- Integers:
42,100 - Floats:
0.001,3.14 - Strings:
mnist,"output/results" - Booleans:
true,false - Null:
null,none - Lists:
[0.0, 0.3, 0.5],[fp32, fp16, int8]
Some fields have default values if not specified:
dataloader_seed defaults to seed, num_workers defaults to 2, benchmark_repeats defaults to 5, and memory_bandwidth_gbps defaults to 12.8.Usage Example
Error Handling
The function will raise exceptions for:- FileNotFoundError: Config file doesn’t exist
- KeyError: Required field missing from config file
- ValueError: Invalid value format or type conversion failure