ml-data-pipeline-architecture_skill

This skill helps optimize ML data pipelines by choosing Polars, Arrow, and ClickHouse patterns for memory-efficient, lazy, zero-copy processing.
  • TypeScript

14

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill terrylica/cc-skills --skill ml-data-pipeline-architecture

  • SKILL.md9.9 KB

Overview

This skill captures proven architecture patterns for efficient ML data pipelines using Polars, Apache Arrow, and ClickHouse. It explains decision criteria, zero-copy data flows, lazy evaluation, and scalable PyTorch integration to reduce memory use and speed up ETL and training. The guidance is practical, migration-ready, and focused on production constraints.

How this skill works

I describe when to prefer Polars over Pandas and how to wire Arrow-backed transfers from ClickHouse into Polars for minimal copies. The patterns include Arrow stream ingestion, lazy scan APIs, Parquet batch flows, and a memory-efficient bridge into PyTorch DataLoaders. I also cover schema validation, benchmarks, migration steps, and anti-patterns to avoid common traps.

When to use it

  • Choosing Polars vs Pandas based on dataset size and operation type
  • Building zero-copy pipelines from ClickHouse into ML training
  • Optimizing memory and throughput for >1M-row datasets
  • Converting batch jobs to lazy, predicate-pushed pipelines
  • Feeding large datasets into PyTorch without loading full dataset into RAM

Best practices

  • Prefer Polars for >1M rows and heavy group-by or join workloads
  • Use ClickHouse → ArrowStream → pl.from_arrow for zero-copy ingestion
  • Compose transformations with pl.scan_* and call .collect() only at the end
  • Validate schemas early and fail-fast with clear error messages
  • Avoid round-tripping to pandas; keep data in Arrow/Polars to prevent extra copies

Example use cases

  • Stream large ClickHouse result sets into a Polars-backed training pipeline with 1.2x peak memory
  • Migrate a Pandas-based ETL to Polars using Arrow transfer and lazy scans to cut runtime by 5–10x
  • Serve batches to PyTorch using a PolarsDataset that slices an Arrow table for per-row access
  • Export reproducible batch inputs to Parquet, process lazily, and apply predicate pushdown
  • Implement schema-driven feature validation with Pydantic before model training

FAQ

Use Pandas for small datasets (<1M rows), or when you rely on a Pandas-only ecosystem like certain scikit-learn utilities.

How do I ensure zero-copy from ClickHouse to tensors?

Stream results as Arrow, convert to Polars with pl.from_arrow, select features and call .to_numpy() then torch.from_numpy() to avoid intermediate copies.

What are the common causes of Arrow conversion failures?

Unsupported object-typed columns or mixed types; convert those columns to native types before Arrow serialization.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
ml-data-pipeline-architecture skill by terrylica/cc-skills | VeilStrat