kempnerforge.config.data¶
Data pipeline configuration.
Functions
|
Reject a |
Classes
Data pipeline settings. |
|
A single data source in a multi-dataset mixture. |
|
A training phase with custom dataset weights and LR scaling. |
- kempnerforge.config.data.check_token_dtype(value, key)[source]¶
Reject a
token_dtypethat is neither""nor one ofTOKEN_DTYPES.
- class kempnerforge.config.data.DatasetSource[source]¶
Bases:
objectA single data source in a multi-dataset mixture.
Either
path(pre-tokenized) orhf_name(HuggingFace) must be set.weightcontrols the relative sampling probability.token_dtypeoverridesdata.token_dtypefor the.binshards underpath. The mixture knows the source bymixture_name, which no other source of the mixture may share.
- class kempnerforge.config.data.TrainingPhase[source]¶
Bases:
objectA training phase with custom dataset weights and LR scaling.
From
start_step, the learning rate is multiplied bylr_scaleon any run, and the sampler of a[[data.datasets]]mixture switches todataset_weights, keyed byDatasetSource.mixture_name.JobConfig.validaterefuses the weights on a run that builds no mixture, and a key that names no source.
- class kempnerforge.config.data.DataConfig[source]¶
Bases:
objectData pipeline settings.
token_dtypeis the integer type of the raw.bintoken shards,"uint16"or"uint32", fordataset_pathand everydatasetssource that does not set its own. Left empty, themetadata.yamlnext to the shards decides, asMemoryMappedDatasetdescribes..npyshards carry their dtype in their header and ignore it.- datasets: list[DatasetSource]¶
- phases: list[TrainingPhase]¶
- mixture_weight_fields()[source]¶
The settings that reweight a
[[data.datasets]]mixture, named for an error.Each phase that sets
dataset_weights, andanneal_start_stepwithanneal_weightswhen the two make a phase. A run without a mixture refuses them.
- unknown_mixture_weight_keys()[source]¶
The keys of each setting
mixture_weight_fieldslists that name no source.Maps
data.phases[i].dataset_weights, anddata.anneal_weightswhenanneal_start_stepmakes it a phase, to its sorted keys that match noDatasetSource.mixture_nameindatasets. A setting whose keys all match is left out, so the result is empty when every key names a source.
- duplicate_mixture_names()[source]¶
Each
DatasetSource.mixture_namethat two or moredatasetssources go by.Maps each such name, in the order the names first appear, to the indices of its sources in
datasets. The result is empty when every source has a name of its own.
- __init__(dataset_path='', file_pattern='*.npy', token_dtype='', tokenizer_path='', num_workers=4, pin_memory=True, prefetch_factor=2, hf_dataset_name=None, hf_dataset_config=None, hf_dataset_split='train', hf_dataset_text_field='text', hf_dataset_image_field='image', hf_dataset_prompt_field='', hf_image_size=224, hf_max_images=1, hf_streaming=False, pack_sequences=False, datasets=<factory>, mix_temperature=1.0, phases=<factory>, anneal_start_step=0, anneal_weights=<factory>)¶
- Parameters:
dataset_path (str)
file_pattern (str)
token_dtype (str)
tokenizer_path (str)
num_workers (int)
pin_memory (bool)
prefetch_factor (int)
hf_dataset_name (str | None)
hf_dataset_config (str | None)
hf_dataset_split (str)
hf_dataset_text_field (str)
hf_dataset_image_field (str)
hf_dataset_prompt_field (str)
hf_image_size (int)
hf_max_images (int)
hf_streaming (bool)
pack_sequences (bool)
datasets (list[DatasetSource])
mix_temperature (float)
phases (list[TrainingPhase])
anneal_start_step (int)
- Return type:
None