You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your great work. Chronos gets good performance on our own dataset by zero-shot prediction. But it seems that Chronos is unable to capture patterns of long periods, for example, I have a feature with a cycle of weeks, and my data is 15 minutes per step, with a sequence length of 96 * 7=602 for a single cycle, which exceeds the context_length of the model. Is there any way for the model to capture such periodic features, or can I only retrain the model?
Hi @Riofd. Indeed, the model internally limits the context length (currently happens here).
You can increase the model context length after loading it, as in the example below. However the models were trained with windows of data of limited length, so they may not be able to make sense of the increased context: it's something for experiments to verify. I believe that for proper handling of longer context, we will need to pretrain the models with longer windows of data, but let us know if the following works!
Here I use pipeline.embed to be able to inspect the encoder output shape, but this would have the same effect if you do pipeline.predict instead:
importtorchfromchronosimportChronosPipelinepipeline=ChronosPipeline.from_pretrained("amazon/chronos-t5-tiny")
context=torch.ones(size=(2000,))
# get encoder embeddingsembedding, _=pipeline.embed(context=context)
print(embedding.shape)
# patch the context lengthpipeline.tokenizer.config.context_length=1024# get encoder embeddings againembedding, _=pipeline.embed(context=context)
print(embedding.shape)
Thank you for your reply. I try your way and successfully get different result comparing with context_length=512, but the forecasting performance decreases significantly. Maybe I should try to fine-tune it?
Activity
lostella commentedon May 12, 2024
Hi @Riofd. Indeed, the model internally limits the context length (currently happens here).
You can increase the model context length after loading it, as in the example below. However the models were trained with windows of data of limited length, so they may not be able to make sense of the increased context: it's something for experiments to verify. I believe that for proper handling of longer context, we will need to pretrain the models with longer windows of data, but let us know if the following works!
Here I use
pipeline.embedto be able to inspect the encoder output shape, but this would have the same effect if you dopipeline.predictinstead:outputs
where 513 is 512 (the original model context length) + the EOS token embedding, and similarly 1025 after the patching.
Riofd commentedon May 13, 2024
Thank you for your reply. I try your way and successfully get different result comparing with
context_length=512, but the forecasting performance decreases significantly. Maybe I should try to fine-tune it?lostella commentedon May 13, 2024
Yes, fine-tuning may be the best way to go. We added code and some instructions here, let me know if you run into any issue
abdulfatir commentedon May 30, 2024
Let's keep this open as a FAQ.