Commit Graph
6 Commits
Author SHA1 Message Date
darkpowerxo b6ac2b3559 docs: add README for the PEFT fine-tuning pipeline
Covers quick start, Python API, CLI reference, adapter loading/merging,
architecture overview with parameter counts, and file layout.
2026-04-08 13:53:43 -04:00
darkpowerxo a67eeb2e7d feat: add CLI entry-point and launch script for PEFT fine-tuning
- finetune.py: argparse CLI with all config flags, CSV data loading,
  chronological train/val split, and full training pipeline
  Usage: python -m peft.finetune --data_path data.csv --value_col y
  Multi-GPU: torchrun --nproc_per_node=4 -m peft.finetune ...

- finetune.sh: env-var driven launch script for single/multi-GPU
  Usage: DATA_PATH=data.csv NUM_GPUS=4 bash peft/finetune.sh
2026-04-08 13:53:35 -04:00
darkpowerxo eca7ca3428 feat: add multi-GPU PEFT trainer for TimesFM 2.5
PEFTTrainer with production-grade training loop:
- PyTorch DDP multi-GPU via torchrun
- Mixed-precision training (fp16/bf16) with GradScaler
- Gradient checkpointing for long contexts
- Cosine-with-warmup LR schedule
- MSE loss + optional pinball quantile loss (9 channels)
- Early stopping on validation loss
- Adapter-only checkpointing (safetensors)
- W&B logging (rank-0 only)
- Differentiable training forward that replicates the 2.5
  patch -> RevIN -> transformer -> output-head -> un-RevIN path
2026-04-08 13:52:59 -04:00
darkpowerxo 9875d926fe feat: add TimeSeriesDataset for PEFT fine-tuning
Sliding-window dataset that produces (context, mask, target) tuples:
- Accepts list of arrays, long-format, or wide-format DataFrames
- Context length auto-rounded to multiple of patch_len (32)
- Left-pads short series with proper masking
- Configurable stride for window overlap
2026-04-08 13:52:19 -04:00
darkpowerxo 7357458e45 feat: add LoRA/DoRA adapter layers for TimesFM 2.5 (PyTorch)
Implement production-grade PEFT adapters targeting the 2.5 architecture:

- LoRALinear: low-rank A/B decomposition with scaling (alpha/rank)
- DoRALinear: weight-decomposed LoRA (magnitude + direction)
- inject_adapters(): freezes base weights, wraps target nn.Linear modules
  - Supports fused QKV (qkv_proj), attention output, and FFN layers
  - num_adapter_layers controls how many top layers get adapters (0=all)
  - target_modules selects 'all', 'attention', or 'ffn'
- merge_adapters(): folds adapter deltas back into base nn.Linear
- save/load_adapter_weights(): safetensors adapter-only checkpoints
- PEFTConfig dataclass with all hyperparameters

References:
  LoRA — https://arxiv.org/abs/2106.09685
  DoRA — https://arxiv.org/abs/2402.09353
2026-04-08 13:51:55 -04:00
darkpowerxo aa2b17f0b3 chore: update .gitignore for egg-info, uv.lock, peft_checkpoints
- Replace timesfm_jax.egg-info/ with generic *.egg-info/ glob
- Add uv.lock (lockfile is environment-specific)
- Add peft_checkpoints/ (training output directory)
2026-04-08 13:51:37 -04:00