A lightweight library for defining and managing system configurations for scientific experimentation.
Overall
score
97%
Evaluation — 97%
↑ 1.05xAgent success when using this tile
Build a command-line interface for managing machine learning training configurations. The system should load default configurations and allow users to override specific settings via command-line arguments.
You need to implement a Python script that:
Defines a default configuration structure with the following settings:
MODEL.TYPE: string, default "resnet50"MODEL.NUM_LAYERS: integer, default 50TRAIN.LEARNING_RATE: float, default 0.001TRAIN.BATCH_SIZE: integer, default 32TRAIN.EPOCHS: integer, default 100DATA.ROOT_PATH: string, default "/data"DATA.AUGMENT: boolean, default TrueAccepts command-line arguments in key-value pairs to override default settings. The arguments should follow the pattern: KEY1 VALUE1 KEY2 VALUE2 ...
Merges the command-line overrides into the configuration, maintaining type safety.
Prints the final configuration in a readable format showing all settings after applying overrides.
# Override learning rate and batch size
python config_cli.py TRAIN.LEARNING_RATE 0.01 TRAIN.BATCH_SIZE 64
# Expected output format (values should reflect overrides):
MODEL:
NUM_LAYERS: 50
TYPE: resnet50
TRAIN:
BATCH_SIZE: 64
EPOCHS: 100
LEARNING_RATE: 0.01
DATA:
AUGMENT: True
ROOT_PATH: /dataTRAIN.LEARNING_RATE 0.01 overrides only the learning rate @testTRAIN.BATCH_SIZE 128 MODEL.TYPE resnet101 overrides multiple values @test@generates
def get_default_config():
"""
Returns the default configuration structure.
Returns:
Configuration object with default values
"""
pass
def apply_cli_overrides(config, cli_args):
"""
Applies command-line argument overrides to the configuration.
Args:
config: The base configuration object
cli_args: List of command-line arguments in key-value pairs
Returns:
Configuration object with overrides applied
"""
pass
def main():
"""
Main entry point. Parses command-line arguments and prints final configuration.
"""
pass
if __name__ == "__main__":
main()Configuration management system for merging settings from different sources.
Install with Tessl CLI
npx tessl i tessl/pypi-yacsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10