Preprocess Command Guide¶
The sequifier preprocess command transforms raw tabular data (CSV or Parquet) into the specific sequence format required for training transformer sequence models. It handles windowing, data splitting (train/validation/test), categorical encoding, and optional numerical standardization.
Usage¶
sequifier preprocess --config-path configs/preprocess.yaml
CLI Overrides¶
Values passed on the command line override the YAML before validation.
Flag |
Overrides / Action |
|---|---|
|
Generates a random |
|
Overrides |
|
Overrides |
Composable Configuration Files¶
A preprocessing entry config may set additional_config_paths to one
non-empty string, a list of non-empty strings, or null. Relative paths
resolve against the entry config’s project_root; absolute paths are used
directly. Fragments are direct only and cannot include further fragments. They
may share nested containers when their child fields are disjoint, but duplicate
fields are errors. CLI values override the completed file composition.
Configuration Fields¶
The configuration is defined in a YAML file (e.g., preprocess.yaml). Below are the available fields, their requirements, and their functions.
1. File System & Input/Output¶
Field |
Type |
Mandatory |
Default |
Description |
|---|---|---|---|---|
|
|
Yes |
- |
The root directory of your Sequifier project. Usually |
|
|
No |
|
Direct complementary YAML fragments. Relative paths resolve against |
|
|
Yes |
- |
Path to the raw input file or folder. |
|
|
No |
|
Format of input data ( |
|
|
No |
|
Format of output data ( |
|
|
No |
|
Whether to merge split files into single files or keep them sharded. |
|
|
No |
|
If |
Important Constraint on
write_format:
If
write_formatispt(PyTorch tensors),merge_outputmust befalse.If
write_formatisparquet,merge_outputcan befalseortrue.If
write_formatiscsv,merge_outputmust betrue. For distributed training,merge_outputmust be set tofalse.
2. Column Selection & Filtering¶
Field |
Type |
Mandatory |
Default |
Description |
|---|---|---|---|---|
|
|
No |
|
A specific list of columns to process. If |
|
|
No |
|
Optional output dtype map for processed columns, such as |
|
|
No |
|
If |
|
|
No |
|
Limits processing to the first N rows. Useful for rapid debugging. |
|
|
No |
|
Use a preexisting metadata config for tokenizing discrete columns and, when enabled, standardizing real-valued columns. |
|
|
No |
|
Optional input column used as a row-level mask. If set, |
|
|
No |
|
If not |
3. Sequence Logic & Splitting¶
Field |
Type |
Mandatory |
Default |
Description |
|---|---|---|---|---|
|
|
Yes |
- |
The physical serialized window width written to preprocessed data. |
|
|
No |
|
Number of future items retained after the model input window. Use |
|
|
Yes |
- |
Ordered train/validation/test proportions. Must sum to 1.0. |
|
|
No |
|
How rows are assigned to splits ( |
|
|
No |
|
Window stride for each split; entry |
|
|
No |
|
Strategy for selecting start indices ( |
|
|
No |
|
If |
4. Performance & System¶
Field |
Type |
Mandatory |
Default |
Description |
|---|---|---|---|---|
|
|
No |
|
Random seed for reproducibility. |
|
|
No |
Max Cores |
Number of CPU cores to use for parallel processing. |
|
|
No |
|
Only used when |
|
|
No |
|
Memory optimization. If |
Key Trade-offs and Decisions¶
1. write_format: parquet vs. pt¶
Choose
parquet(default): Unless you have a specific reason, useparquet. Note: If you are doing distributed training, Parquet support is currently in Beta.Choose
pt: Useptdata loading if speed and CPU overhead are your primary bottlenecks, or if you are running multi-GPU distributed training. This format is the most stable choice for high-throughput scaling.
2. window_strides configuration¶
window_length: non-overlapping windows and less data.1: maximum overlap, coverage, storage, and training time.A common compromise is a larger train/validation stride and test stride
1, for examplewindow_strides: [24, 24, 1].
3. window_placement: distribute vs exact¶
distribute(Default): The algorithm adjusts the start indices slightly to minimize the overlap of the final subsequence with the previous one, ensuring the data covers the full sequence length as evenly as possible. Recommended for most use cases.exact: Strictly enforces the stride. If the sequence length minus the window size isn’t perfectly divisible by the stride, this will raise an error. Use this only if mathematical precision of the sliding window is strictly required by your downstream application or evaluation code.
4. Advanced: Static Vocabularies (Custom ID Maps)¶
By default, Sequifier dynamically builds ID maps from the data found in the input file. However, in production systems, you often need a fixed vocabulary to ensure that ID “105” always maps to “Item_X”, regardless of the daily training batch.
To use a static vocabulary:
Create a folder
configs/id_maps/in your project root.Add JSON files named
{COLUMN_NAME}.json.The format must be a dictionary mapping ordinary data values to integers starting at 3. Reserved labels may be included only with their fixed IDs.
Reserved Indices:
0: Reserved for
[unknown](padding/missing).1: Reserved for
[other](unseen values not in your map).2: Reserved for
[mask].3+: Your data.
Example configs/id_maps/itemId.json:
{
"apple": 3,
"banana": 4,
"cherry": 5
}
Outputs¶
After running preprocess, the following are generated:
Data Files: Located in
data/. Depending on your configuration, these will be merged files such as[NAME]-split0.parquet(Training),[NAME]-split1.parquet(Validation), etc., or split folders such as[NAME]-split0/containing.ptor.parquetshards.Metadata Config: Located in
configs/metadata_configs/[NAME].json.Crucial: This file contains the integer mappings for categorical variables (
id_maps), statistics for real variables (selected_columns_statistics), and whether those variables were normalized (normalize_real_columns).Next Step: Reference this file from
dataset.part.metadata_config_pathin a singleton training config, or fromdataset_training.<dataset>.parts.<part>.metadata_config_pathin a named training config. In inference, eitherpreprocessing_data_pathormetadata_config_pathcan locate the metadata and its split paths.