Commit Graph

303 Commits

Author SHA1 Message Date
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
Yichen Zhou f085b90799 Update README.md 2026-04-02 17:26:33 -07:00
Yichen Zhou 104b1d3ee4 Update README.md 2026-04-02 17:25:08 -07:00
Yichen Zhou ed602f95a3 Update README.md 2026-04-01 14:46:32 -07:00
Yichen Zhou ed29ec5ef7 Merge pull request #376 from yasumorishima/fix/xreg-mode-docstring
docs: fix swapped xreg_mode descriptions in forecast_with_covariates
2026-03-19 13:40:56 -07:00
Yichen Zhou 2c1052be94 Merge pull request #369 from borealBytes/feat/timesfm-forecasting-skill
feat(skill): ship first-party timesfm-forecasting Agent Skill (agentskills.io)
2026-03-19 10:36:46 -07:00
Yasunori Morishima(盛島康徳) babdee5208 docs: fix swapped xreg_mode descriptions in forecast_with_covariates docstring
The docstring had the descriptions for "xreg + timesfm" and
"timesfm + xreg" modes swapped relative to the implementation.

Fixes #275
2026-03-19 11:11:55 +00:00
Rajat Sen a3beaa8421 Merge pull request #372 from kashif/modelhubmixin
[HF] use the ModelHubMixin api
2026-03-11 11:04:43 -07:00
Kashif Rasul d2cb4849b6 fix docs string 2026-03-11 17:38:09 +01:00
Kashif Rasul 0134e55a6e Replace ModelHubMixin with PytorchModelHubMixin 2026-03-11 09:36:14 +01:00
Kashif Rasul a8bcd5d6d9 use the ModelHubMixin api 2026-03-06 10:53:18 +01:00
borealBytes 5aad77bd61 docs: address PR #369 review comments and add dataset preflight
- Add context limit rationale to system_requirements.md with memory formula
- Update SKILL.md to include XReg/covariates in description and usage sections
- Add dataset-aware memory estimation to check_system.py with new CLI args
- Document memory estimation in api_reference.md with Mermaid diagram
- Add dataset preflight section to SKILL.md with examples

Resolves review comments about:
- How context limits (512/1024) were determined
- Including XReg mode description in skill documentation

Bonus enhancement: Dataset preflight checking prevents OOM before loading data.
2026-02-25 21:27:31 -05:00
Clayton Young 1c959c8919 feat(agents): add AGENTS.md entry point at repo root
Short pointer for agents working directly in this repo.
Points to timesfm-forecasting/SKILL.md and provides
install commands for the first-party Agent Skill.
2026-02-22 13:40:52 -05:00
Clayton Young a83dbf3f16 refactor(skill): replace claude-specific dirs with agentskills.io standard
Replace AGENTS.md / claude-skill/ with a proper agentskills.io-compliant
skill directory. Any AI agent that supports the open Agent Skills standard
(Claude Code, OpenCode, Cursor, Codex, etc.) can now install and use this
skill generically.

Changes:
- Remove AGENTS.md (was Claude-specific convention)
- Remove claude-skill/ directory (was Claude-specific naming)
- Add timesfm-forecasting/SKILL.md with compliant frontmatter:
    name: timesfm-forecasting
    description: ...
    license: Apache-2.0
    metadata: author, version
- Rename claude-skill/examples/ → timesfm-forecasting/examples/
- Rename claude-skill/scripts/  → timesfm-forecasting/scripts/
- Rename claude-skill/references/ → timesfm-forecasting/references/
- Update .gitattributes paths to match new directory

Skill installs via:
  cp -r timesfm-forecasting/ ~/.claude/skills/
  cp -r timesfm-forecasting/ ~/.cursor/skills/
  # or any agent that supports agentskills.io

Spec: https://agentskills.io/specification
2026-02-22 13:35:05 -05:00
Clayton Young 6c44413b7f feat(skill): add timesfm-forecasting Agent Skill (agentskills.io)
Add a self-contained AI agent skill for TimesFM that teaches coding
agents (Claude Code, OpenCode, Cursor, Codex) how to use the TimesFM
API correctly — safe model loading, zero-shot forecasting, covariate
workflows, anomaly detection, and the most common pitfalls.

Files added:
- AGENTS.md             — auto-loaded skill document (root of repo)
- claude-skill/scripts/check_system.py    — mandatory preflight RAM/GPU/disk checker
- claude-skill/scripts/forecast_csv.py   — CLI wrapper for CSV forecasting
- claude-skill/references/               — ForecastConfig API ref, data prep, HW reqs
- claude-skill/examples/global-temperature/   — basic forecast + PNG/GIF pipeline
- claude-skill/examples/anomaly-detection/    — two-phase detrend+Z-score + quantile PI
- claude-skill/examples/covariates-forecasting/ — forecast_with_covariates() XReg demo
- .gitattributes        — Git LFS rules for PNG/GIF binary outputs

Contributed by Clayton Young / Superior Byte Works LLC (@borealBytes)
Apache 2.0 — same license as this repository
2026-02-22 13:25:39 -05:00
Rajat Sen 8a755c9c75 Merge pull request #341 from kashif/timesfmv1-var
[TimesFMv1] fix variance calculation
2026-02-18 16:22:59 -08:00
Kashif Rasul 177ab03e9c fix v1 jax version 2026-02-18 14:50:56 +01:00
Yichen Zhou 2dcc66fbfe Merge pull request #360 from google-research/siriuz42-patch-3
Update pyproject.toml
2026-01-27 10:53:07 -08:00
Yichen Zhou 4f0bd19a92 Update pyproject.toml
support python 3.10
2026-01-27 10:51:19 -08:00
Yichen Zhou 6bd8044275 Merge pull request #345 from google-research/siriuz42-patch-2
Update timesfm_2p5_flax.py
2025-12-05 13:48:40 -08:00
Yichen Zhou f7f6fa5d99 Update timesfm_2p5_flax.py
Allow compile to delay the jitting run.
2025-12-05 09:46:19 -08:00
Kashif Rasul 705685c912 fix v1 var calculation
1. Masked variance calculation (lines 95-107): Changed from the numerically unstable E[X²] - E[X]² formula  to the stable centered formula E[(X-μ)²]
  2. Sigma clamping (line 609): Changed from torch.where(sigma < tolerance, 1.0, sigma) to torch.clamp(sigma,   min=tolerance)
2025-11-25 09:40:07 +01:00
Rajat Sen bf88c5dc88 Merge pull request #335 from google-research/rajat-dev
adapt to new huggingface_hub interface
2025-10-31 10:45:25 -07:00
Rajat Sen 3bb141947e adapt to new huggingface_hub interface 2025-10-31 17:41:31 +00:00
Rajat Sen ddfa6cd9d8 Merge pull request #332 from google-research/rajat-dev
manually download config.json
2025-10-30 13:23:28 -07:00
Rajat Sen be91ef8ee3 manually download config.json 2025-10-30 20:11:16 +00:00
Yichen Zhou c43e8f3e66 Update README.md 2025-10-29 17:45:32 -07:00
Yichen Zhou a7435a190f Merge pull request #329 from google-research/siriuz42-2.0-pr
Bring back xreg for TimesFM 2.5
2025-10-29 17:41:32 -07:00
siriuz42 ba2417e11a update requirement 2025-10-28 22:40:21 +00:00
siriuz42 0d4d5141d7 covariate support 2025-10-28 22:30:24 +00:00
siriuz42 c24db2afd2 covariate support 2025-10-28 22:29:40 +00:00
siriuz42 80f1a1eafe Merge remote-tracking branch 'origin/master' into siriuz42-2.0-pr 2025-10-28 17:50:55 +00:00
Rajat Sen 58e01ad82f Merge pull request #326 from google-research/siriuz42-patch-1
Update timesfm_2p5_flax.py
2025-10-08 16:15:28 -07:00
Yichen Zhou a6609df1d5 Update timesfm_2p5_flax.py
bug fix
2025-10-08 16:03:18 -07:00
siriuz42 b6b207a4ed bug fix 2025-10-08 22:59:07 +00:00
Rajat Sen ce168ffd1f Merge pull request #325 from google-research/siriuz42-2.0-pr
Manually trigger jitting in Flax.
2025-10-08 09:37:10 -07:00
siriuz42 9080939cb8 Manually trigger jitting in Flax. 2025-10-08 16:32:41 +00:00
Rajat Sen a21b1d5b25 Merge pull request #324 from google-research/rajat-dev
Use uv instead of poetry
2025-10-08 09:08:15 -07:00
Rajat Sen bf23fb4880 readme update and not pinning cuda versin for flax 2025-10-08 15:50:21 +00:00
Rajat Sen cae3104aa6 yml file changes 2025-10-08 00:21:25 +00:00
Rajat Sen 604ad59067 yml file changes 2025-10-08 00:19:55 +00:00
Rajat Sen c172faf5eb yml file changes 2025-10-08 00:14:50 +00:00
Rajat Sen 1c0cd87f2b updating workflows 2025-10-08 00:06:52 +00:00
Rajat Sen 39df49c3a0 uv installation instructions 2025-10-07 23:58:53 +00:00
Rajat Sen 56e7fd67c6 pulled flax changes from master 2025-10-07 21:46:30 +00:00
Rajat Sen 018b2557ab changes to workflow 2025-10-07 21:38:22 +00:00
Yichen Zhou fe70095c6c Merge pull request #323 from google-research/siriuz42-2.0-pr
flax
2025-10-07 14:37:26 -07:00
siriuz42 1436ad859c fix typo 2025-10-07 21:26:57 +00:00
siriuz42 ff2cefaa26 minor changes 2025-10-07 20:41:38 +00:00