data-pipeline
Prepare tabular time-series data for PyTorch Forecasting v1 TimeSeriesDataSet, encoders, normalizers, dataloaders, serialization, and validation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- data-pipeline
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Prepare tabular time-series data for PyTorch Forecasting v1 TimeSeriesDataSet, encoders, normalizers, dataloaders, serialization, and validation.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/data-validation-and-troubleshooting.md12.1 KB
- 参考文档references/time-series-dataset.md16.7 KB
- 脚本scripts/validate_timeseries_dataframe.py22.4 KB
03 SKILL.md 正文
Data Pipeline Sub-skill
Use this sub-skill when the task is to turn a pandas-style tabular time-series DataFrame into PyTorch Forecasting 1.8.0 data objects for training, validation, testing, or prediction. The primary API is pytorch_forecasting.TimeSeriesDataSet and the v1 data utilities under pytorch_forecasting.data.
Route here for
- Choosing and declaring
time_idx,target,group_ids, static covariates, known-future covariates, unknown-future covariates, weights, lags, encoders, scalers, and target normalizers. - Creating
TimeSeriesDataSetobjects for train/validation/test/predict workflows withTimeSeriesDataSet.from_dataset()orTimeSeriesDataSet.from_parameters(). - Converting datasets to PyTorch dataloaders with
TimeSeriesDataSet.to_dataloader()and understanding returned batch keys and shapes. - Handling missing timesteps, categorical unknowns, target normalization, dataset serialization, and pre-flight DataFrame validation.
Route away
- Model architecture selection,
.from_dataset()model construction, checkpoint loading, and prediction API details belong in../forecasting-models/SKILL.md. - Losses, metrics, quantiles, Optuna tuning, and learning-rate finder decisions belong in
../metrics-and-tuning/SKILL.md. - Experimental v2
TimeSeriesandEncoderDecoderTimeSeriesDataModuleworkflows belong in../api-v2-workflows/SKILL.md.
Bundled references and scripts
- Use
references/time-series-dataset.mdwhen you need the v1TimeSeriesDataSetconstructor contract, column-role map, train/validation/inference recipes, normalizer/encoder notes, dataloader shapes, serialization, and validation snippets. - Use
references/data-validation-and-troubleshooting.mdwhen data construction fails or behaves unexpectedly; it maps symptoms to likely causes and concrete recovery steps for NaNs, gaps, short series, categorical unknowns, normalizers, and shape surprises. - Use
scripts/validate_timeseries_dataframe.pybefore constructing a dataset from a CSV to catch missing required columns, duplicate group/time rows, target NaNs, role overlap, non-integer time indexes, sort issues, gaps, and too-short groups without importing PyTorch Forecasting.
Minimal working pattern
from pytorch_forecasting import TimeSeriesDataSet
from pytorch_forecasting.data import GroupNormalizer, NaNLabelEncoder
training = TimeSeriesDataSet(
train_df,
time_idx="time_idx", # integer, increasing within each group
target="sales", # continuous or categorical target column
group_ids=["store", "sku"], # columns that identify one series
max_encoder_length=36,
max_prediction_length=6,
static_categoricals=["store", "sku"],
time_varying_known_reals=["time_idx", "price", "promotion"],
time_varying_unknown_reals=["sales"],
target_normalizer=GroupNormalizer(groups=["store", "sku"], transformation="log1p"),
categorical_encoders={"sku": NaNLabelEncoder(add_nan=True)},
)
validation = TimeSeriesDataSet.from_dataset(
training,
full_df,
min_prediction_idx=train_df["time_idx"].max() + 1,
stop_randomization=True,
)
train_loader = training.to_dataloader(train=True, batch_size=64, num_workers=0)
val_loader = validation.to_dataloader(train=False, batch_size=64, num_workers=0)
If a task starts from CSV, run the bundled validator first, then use the references above to construct the actual TimeSeriesDataSet.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).