-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to increase the context length? #70
Comments
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 import torch
from chronos import ChronosPipeline
pipeline = ChronosPipeline.from_pretrained("amazon/chronos-t5-tiny")
context = torch.ones(size=(2000,))
# get encoder embeddings
embedding, _ = pipeline.embed(context=context)
print(embedding.shape)
# patch the context length
pipeline.tokenizer.config.context_length = 1024
# get encoder embeddings again
embedding, _ = pipeline.embed(context=context)
print(embedding.shape) outputs
where 513 is 512 (the original model context length) + the EOS token embedding, and similarly 1025 after the patching. |
Thank you for your reply. I try your way and successfully get different result comparing with |
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 |
Let's keep this open as a FAQ. |
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?
The text was updated successfully, but these errors were encountered: