Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for finetuning Chronos (incl. optional checkpoint saving/reuse) within timecopilot’s Chronos forecaster, plus accompanying dependency and documentation updates.
Changes:
- Introduce
ChronosFinetuningConfigand finetune-on-forecast flow (forecast()finetunes on the provided context before predicting). - Add finetuning-related tests and expand the shared model test matrix to include finetuning variants.
- Update dependencies (Chronos wrapper,
peft, transformers constraint) and expose the new config in docs + mkdocs nav.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| timecopilot/models/foundation/chronos.py | Adds finetuning config + finetune hook in forecast(), and special-cases loading LoRA adapter checkpoints. |
| tests/models/foundation/test_chronos.py | Adds an integration-style test covering finetune → save → reuse workflow. |
| tests/models/conftest.py | Adds finetuning-enabled Chronos instances to the global model matrix and new imports. |
| pyproject.toml | Adds peft, bumps Chronos wrapper, relaxes transformers pinning for <3.13. |
| mkdocs.yml | Adds a finetuning example notebook to docs navigation. |
| docs/api/models/foundation/models.md | Exposes ChronosFinetuningConfig in API reference generation. |
Comments suppressed due to low confidence (2)
tests/models/conftest.py:131
- Inside the
sys.version_info < (3, 13)block,Sundialis imported but no longer appended to themodelslist after this change. As written, that import becomes unused (lint failure) and it also drops Sundial from the main model test matrix on supported Python versions. Either re-addSundial(...)tomodelshere or remove the import if the exclusion is intentional.
from tabpfn_time_series import TabPFNMode
from timecopilot.models.foundation.tabpfn import TabPFN
models.append(TabPFN(mode=TabPFNMode.MOCK))
timecopilot/models/foundation/chronos.py:218
BaseChronosPipeline.from_pretrained(...)is called withdtype=self.dtype, but elsewhere (and in existing tests) the expected kwarg istorch_dtype. This likely means the requested weight dtype will be ignored andtest_chronos_model_uses_configured_dtypewill fail (and it may also break compatibility with the underlying Hugging Face/Chronos API). Usetorch_dtype=self.dtypeconsistently here (matching the Chronos2Pipeline branch).
try:
yield model
finally:
del model
torch.cuda.empty_cache()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…meCopilot/timecopilot into feat/funetunning-chronos
There was a problem hiding this comment.
Pull request overview
Adds optional finetuning support for Chronos foundation models, enabling on-the-fly finetuning on the forecast context (including LoRA/PEFT support) and reuse of saved finetuned checkpoints.
Changes:
- Introduce
ChronosFinetuningConfigand integrate optional finetuning intoChronos.forecast(). - Add support for loading saved LoRA checkpoints by selecting
Chronos2Pipeline.from_pretrainedwhenadapter_config.jsonis present. - Update dependencies to support finetuning (add
peft, bumptimecopilot-chronos-forecasting, adjusttransformersconstraints) and surface docs/example notebook entries.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
timecopilot/models/foundation/chronos.py |
Adds finetuning configuration + finetune hook; updates model loading to handle LoRA checkpoints. |
tests/models/foundation/test_chronos.py |
Adds tests for finetuning save/reuse and LoRA save/reuse. |
tests/models/conftest.py |
Removes Sundial from the shared model test matrix. |
pyproject.toml |
Adds peft dependency; bumps chronos forecasting; adjusts transformers constraint for <3.13. |
uv.lock |
Updates lockfile for new/updated dependencies (incl. peft, transformers/tokenizers resolution changes). |
mkdocs.yml |
Adds finetuning notebook to documentation navigation. |
docs/api/models/foundation/models.md |
Exposes ChronosFinetuningConfig in the API docs. |
Comments suppressed due to low confidence (1)
tests/models/conftest.py:114
- This change removes
Sundialfrom the sharedmodelstest matrix for Python <3.13. Since this PR is about Chronos finetuning, this looks like an unrelated coverage reduction; if Sundial is still a supported foundation model, consider keeping it in the matrix (or add a comment/PR description note explaining why it’s excluded).
if sys.version_info < (3, 13):
from tabpfn_time_series import TabPFNMode
from timecopilot.models.foundation.tabpfn import TabPFN
models.append(TabPFN(mode=TabPFNMode.MOCK))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
this pr adds the option to finetune chronos models