micm_nlp.path¶
Filesystem layout: the workspace root and the artefacts/ tree beneath it.
Two kinds of path live here. PACKAGE_DIR points inside the installed package and
is read-only. Everything else hangs off the workspace — the user’s project
directory — which must be set once via set_root() before any accessor is called;
they raise otherwise. micm_nlp.init() does that for you:
workspace()/artefacts/{models,datasets,tokenizers,runs,wandb}
Attributes¶
Where the example configs ship. Inside the package rather than downloaded, so |
|
|
|
|
Functions¶
|
|
|
Every config shipped in the example package. |
|
|
|
|
|
The path of one config shipped inside the package. |
|
Recursively find every directory under |
|
List the immediate contents of a directory, non-recursively. |
|
|
|
The directory one run writes into: config snapshot, |
|
|
|
Set the workspace root. Call once at startup. |
|
|
|
Parent directory for wandb's own |
|
Return the workspace root. |
Module Contents¶
- micm_nlp.path.artefacts_dir() pathlib.Path¶
<workspace>/artefacts— the root of everything this package writes.
- micm_nlp.path.available_examples() list[tuple[pathlib.Path, Any]]¶
Every config shipped in the example package.
The package root and one level of subdirectories (
groups/), sorted by path.- Returns:
(relative path, traversable)pairs. The first line above is kept short and self-contained because the API reference renders it as the summary, and a summary that stops mid-literalis a docs build warning.
- micm_nlp.path.datasets_dir() pathlib.Path¶
artefacts/datasets— raw, preprocessed and tokenized datasets.
- micm_nlp.path.evals_dir() pathlib.Path¶
artefacts/evals— legacy location, no longer written to.Runs live under
runs_dir()since 0.4.0; this function has no callers and is kept only so an existing tree stays addressable.
- micm_nlp.path.example(name: str) pathlib.Path¶
The path of one config shipped inside the package.
run(example('xsc_finetune.yml'))
Reading a config straight out of the installed package, rather than making
runfall back to it for a name that is not on disk – one visible call is easier to explain than a second lookup rule hidden inside the pipeline.micm-nlp init-examplesis still the way to get an editable copy.- Parameters:
name – the file name, with or without
.yml;groups/names work too (example('groups/xsc_tune_across_seeds.yml')).- Raises:
FileNotFoundError – naming what does ship, since the set is small and fixed – a typo should not send anyone to the documentation.
- micm_nlp.path.find_dirs_by_prefix(root_dir, dir_prefix)¶
Recursively find every directory under
root_dirwhose name starts withdir_prefix.Walks the whole tree, so cost grows with the size of
root_dir— the progress bar is there because anartefacts/tree can be large.- Parameters:
root_dir – directory to search under.
dir_prefix – prefix a directory’s name must start with.
- Returns:
absolute paths as strings, in walk order.
- micm_nlp.path.get_dir_items(dir_path, only_dirs=False, only_files=False)¶
List the immediate contents of a directory, non-recursively.
- Parameters:
dir_path – directory to list.
only_dirs – return only subdirectories.
only_files – return only files.
- Returns:
names, with a trailing
/on directories. A missingdir_pathyields[]rather than raising, so callers can probe a path that may not exist yet.
- micm_nlp.path.models_dir() pathlib.Path¶
artefacts/models— saved checkpoints and PEFT adapters.
- micm_nlp.path.output_dir(group: str | None, name: str) pathlib.Path¶
The directory one run writes into: config snapshot,
info.json, metrics, predictions, links, logs.- Parameters:
group – the group’s name, or
Nonefor a run started outside any group config – which lands underUNIT_RUNSinstead.
- micm_nlp.path.runs_dir() pathlib.Path¶
artefacts/runs– one directory per run, underunits/orgroups/{group}/. A run is neither an eval nor a training; it is the unit the trainer executes.
- micm_nlp.path.set_root(workspace: str | pathlib.Path)¶
Set the workspace root. Call once at startup.
- Raises:
ValueError – if no root was given.
micm_nlp.init()passes itsroot_pathstraight through, and that isNonewhen neither the call norPROJECT_ROOT_PATHsupplied one – which used to surface here as aTypeErrorfromPath(None), naming neither the setting nor the fix.
- micm_nlp.path.tokenizers_dir() pathlib.Path¶
artefacts/tokenizers— tokenizers trained by this package.
- micm_nlp.path.wandb_dir() pathlib.Path¶
Parent directory for wandb’s own
wandb/folder.Returns
artefacts/itself, not a subdirectory: wandb appendswandb/to whatever it is given, so the run tree lands atartefacts/wandb/.
- micm_nlp.path.workspace() pathlib.Path¶
Return the workspace root.
- Raises:
RuntimeError – if
set_root()has not been called. Every accessor below goes through here, so an unset root fails loudly at the first path request rather than silently writing into the current directory.
- micm_nlp.path.EXAMPLE_CONFIG_PACKAGE = 'micm_nlp.configs'¶
Where the example configs ship. Inside the package rather than downloaded, so the copy you get always matches the version you installed.
- micm_nlp.path.GROUP_RUNS = 'groups'¶
runs/groups/{group}/{name}. One directory per group keeps an experiment whole – which is why no segment above it varies with the run. An earlier layout led with the model architecture, and split any group that varied the backbone across two trees.- Type:
Where a group’s runs land
- micm_nlp.path.PACKAGE_DIR¶
- micm_nlp.path.UNIT_RUNS = 'units'¶
runs/units/{name}.- Type:
Where a run started outside any group config lands