-
Notifications
You must be signed in to change notification settings - Fork 6
Wiki 2: Data Pipeline & Processing Schema
KhangDS edited this page Jun 3, 2026
·
1 revision
The data processing module enforces total pipeline reproducibility. It transforms raw unstructured textual assets into specialized mathematical tensors ready for deep learning optimization loops.
The structural evolution of the data follows this sequence:
Raw Text / JSON Normalized Standardized Strings Tokenized Arrays Numerical Vector Embeddings
To eliminate runtime validation crashes during distributed extraction, data parsing relies heavily on Pydantic V2. This guarantees that all incoming payloads conform strictly to expected data types, shapes, and boundaries.
-
Token Space Verification: Validates that sequence lengths match the max context window constraint (
$N \le 512$ ). - Label Alignment Check: Verifies that classification targets match the predefined vocabulary schema indices.
from pydantic import BaseModel, Field, field_validator
from typing import List, Optional
class TokenizedBatchSchema(BaseModel):
"""Rigid structural profile for numerical NLP batches."""
input_ids: List[int] = Field(..., description="Numerical token sequences.")
attention_mask: List[int] = Field(..., description="Binary mask to mask padding out of attention calculations.")
label_id: Optional[int] = Field(None, ge=0, description="Target categorization index.")
@field_validator("input_ids")
@classmethod
def check_sequence_length(cls, value: List[int]) -> List[int]:
"""Enforce strict context boundary criteria."""
if len(value) > 512:
raise ValueError("Data Bounds Violation: Sequence length exceeds maximum allowable context window.")
return value