From f0e1ef5b8f3b01052bb2ef95eed6fb9615726cbc Mon Sep 17 00:00:00 2001 From: Abdul Fatir Date: Wed, 3 Dec 2025 17:05:02 +0100 Subject: [PATCH] Chronos-2: Update context_length if fine-tuned with longer than default (#419) *Issue #, if available:* *Description of changes:* By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --- src/chronos/chronos2/pipeline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chronos/chronos2/pipeline.py b/src/chronos/chronos2/pipeline.py index 74b4771..8c10e16 100644 --- a/src/chronos/chronos2/pipeline.py +++ b/src/chronos/chronos2/pipeline.py @@ -331,7 +331,8 @@ class Chronos2Pipeline(BaseChronosPipeline): trainer.train() - # update max_output_patches, if the model was fine-tuned with longer prediction_length + # update context_length and max_output_patches, if the model was fine-tuned with larger values + model.chronos_config.context_length = max(model.chronos_config.context_length, context_length) model.chronos_config.max_output_patches = max( model.chronos_config.max_output_patches, math.ceil(prediction_length / self.model_output_patch_size) )