micm_nlp.pipeline

Pipeline — high-level wiring of the core components.

CONFIG → TOKENIZER → DATASET → MODEL → TRAINER

Usage:

from micm_nlp.pipeline import load_dataset, load_model, run

run() is the whole chain. The single-stage functions beside it are for consumers that drive the stages themselves – a preprocessing-only script, say – and run deliberately does not go through them: its body is the chain written out, so that reading it is reading the pipeline.

Functions

load_dataset(config)

CONFIG → DATASET

load_model(config)

CONFIG → MODEL

preprocess_dataset(config[, tokenizer])

CONFIG → TOKENIZER → DATASET

run(→ micm_nlp.training.run_output.RunOutput | None)

CONFIG → TOKENIZER → DATASET → MODEL → TRAINER → results

Module Contents

micm_nlp.pipeline.load_dataset(config)

CONFIG → DATASET

micm_nlp.pipeline.load_model(config)

CONFIG → MODEL

micm_nlp.pipeline.preprocess_dataset(config, tokenizer=None)

CONFIG → TOKENIZER → DATASET

micm_nlp.pipeline.run(config: micm_nlp.config.CONFIG | str, ctx: micm_nlp.group.RunContext | None = None) → micm_nlp.training.run_output.RunOutput | None

CONFIG → TOKENIZER → DATASET → MODEL → TRAINER → results

ctx is the group runner’s RunContext; this default runner is single-phase and ignores it, so a group runs with no custom code. A separate_test in the entry is therefore not acted on here – that is a runner’s decision.

The body below is the whole chain, written out: it calls the core classes directly rather than the wrappers above, so that reading this function is reading the pipeline, and a consumer that needs to intervene between two stages can copy it and change the one line. tests/test_pipeline_stages.py pins the README’s copy of the sequence against this source.

Parameters:
  • config – a CONFIG, or a path to the YAML of one – so a script needs no separate load step.

  • ctx – the group runner’s RunContext.

Returns:

the run’s RunOutput – its directory, and the metrics and prediction rows it wrote, under the same event names as the files. Returning it rather than the model and the test result gives one object whose shape is the run directory, and reaches the four evaluation results the old pair dropped. None for a mode: preprocess config, which stops after the dataset is tokenised and saved – no model, no trainer, no output directory.