or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/yacs@0.1.x
tile.json

tessl/pypi-yacs

tessl install tessl/pypi-yacs@0.1.0

A lightweight library for defining and managing system configurations for scientific experimentation.

Agent Success

Agent success rate when using this tile

97%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.05x

Baseline

Agent success rate without this tile

92%

task.mdevals/scenario-2/

ML Training Configuration CLI

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.

Requirements

You need to implement a Python script that:

  1. Defines a default configuration structure with the following settings:

    • MODEL.TYPE: string, default "resnet50"
    • MODEL.NUM_LAYERS: integer, default 50
    • TRAIN.LEARNING_RATE: float, default 0.001
    • TRAIN.BATCH_SIZE: integer, default 32
    • TRAIN.EPOCHS: integer, default 100
    • DATA.ROOT_PATH: string, default "/data"
    • DATA.AUGMENT: boolean, default True
  2. Accepts command-line arguments in key-value pairs to override default settings. The arguments should follow the pattern: KEY1 VALUE1 KEY2 VALUE2 ...

  3. Merges the command-line overrides into the configuration, maintaining type safety.

  4. Prints the final configuration in a readable format showing all settings after applying overrides.

Example Usage

# 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: /data

Test Cases

  • Running with no arguments prints the default configuration @test
  • Running with TRAIN.LEARNING_RATE 0.01 overrides only the learning rate @test
  • Running with TRAIN.BATCH_SIZE 128 MODEL.TYPE resnet101 overrides multiple values @test

Implementation

@generates

API

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()

Dependencies { .dependencies }

yacs { .dependency }

Configuration management system for merging settings from different sources.