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.
This commit is contained in:
Abdul Fatir 2025-12-03 17:05:02 +01:00 committed by GitHub
parent 3cb8f8831a
commit f0e1ef5b8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
)