Pipeline¶
trimbed.pipeline
¶
End-to-end trimming pipeline.
TrimPipeline
¶
TrimPipeline(config: TrimConfig)
Runs a configured trim from corpus counting through to saved artefacts.
The stages are exposed as methods so callers can drive them individually, like
our entrypoints trimbed count and trimbed inspect do.
Build a pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TrimConfig
|
The validated run configuration. |
required |
View source on GitHub: src/trimbed/pipeline.py lines 40–46
load
¶
load() -> tuple[PreTrainedTokenizerFast, TokenizerSpec]
Load the tokenizer and parse its backend document (typically tokenizer.json).
Returns:
| Type | Description |
|---|---|
tuple[PreTrainedTokenizerFast, TokenizerSpec]
|
The fast tokenizer and a spec over its tokenizer.json, e.g. a |
count
¶
count(
tokenizer: PreTrainedTokenizerFast,
) -> CorpusCounts | None
Count token frequencies over the configured corpus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenizer
|
PreTrainedTokenizerFast
|
The tokenizer used to encode the corpus. |
required |
Returns:
| Type | Description |
|---|---|
CorpusCounts | None
|
The corpus statistics, or |
run
¶
run(dry_run: bool = False) -> TrimReport
Execute the whole pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dry_run
|
bool
|
Select and report but write nothing to disk. Useful for sweeping
different |
False
|
Returns:
| Type | Description |
|---|---|
TrimReport
|
The report describing what happened. |