micm_nlp.cli

Command line entry point: micm-nlp / python -m micm_nlp.

Three subcommands. run executes one unit config; run-group executes the entries of a group config (see micm_nlp.group); init-examples copies the example configurations out of the installed package into a directory you can edit. Flags the parser does not know are forwarded to the runner as ctx.extras (--source-group joshi5 -> {'source_group': 'joshi5'}):

python -m micm_nlp run       --config configs/examples/xsc_finetune.yml
python -m micm_nlp run-group --group-config configs/examples/groups/xsc_tune_across_seeds.yml
python -m micm_nlp init-examples

The configs ship inside the package rather than being downloaded, so the copy you get always matches the version you installed. Fetching them over the network would introduce the one failure this is meant to avoid – a config written for a different release, or no config at all on a machine without internet.

No example scripts exist: running a shipped config is run / run-group above, so a script would be a third path to what these commands already do. What carries the content is the YAML.

Attributes

Functions

init_examples(→ int)

Copy the shipped example configs into dest.

main(→ int)

Parse arguments and dispatch. Returns the process exit code.

parse_extras(→ dict)

Unknown --flag value / --flag=value / --flag arguments as a

Module Contents

micm_nlp.cli.init_examples(dest: str | pathlib.Path = DEFAULT_DEST, force: bool = False) → int

Copy the shipped example configs into dest.

Parameters:
  • dest – directory to write into; created if missing.

  • force – overwrite files that are already there. Without it an existing file is left alone and reported, so a config you have edited is never silently replaced.

Returns:

0. Skipping an existing file is a normal outcome, not an error – returning non-zero for it would break any script that runs this more than once.

micm_nlp.cli.main(argv: list[str] | None = None) → int

Parse arguments and dispatch. Returns the process exit code.

micm_nlp.cli.parse_extras(rest: list[str]) → dict

Unknown --flag value / --flag=value / --flag arguments as a dict for the runner.

Values stay strings – the runner knows their types. A bare --flag becomes True. Anything that is not a flag is an error, so a typo in a known option cannot silently become a runner extra.

Raises:

ValueError – on a token that does not start with --.

micm_nlp.cli.DEFAULT_DEST = 'configs/examples'