-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Add TimesFM Time Series Forecasting Model #34082
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work.
One general question: are there plans to support decoder only training and associated loss functions ?
|
||
# B x N x D | ||
patched_inputs = patched_inputs * (1.0 - patched_pads) | ||
print(">>> PatchedDecoder patched_inputs", patched_inputs.shape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not sure if these print statements are necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is still in progress. We will make sure to eliminate all debug info when ready for review.
patched_inputs = patched_inputs * (1.0 - patched_pads) | ||
print(">>> PatchedDecoder patched_inputs", patched_inputs.shape) | ||
concat_inputs = torch.cat([patched_inputs, patched_pads], dim=-1) | ||
print(">>> PatchedDecoder concat_inputs", concat_inputs.shape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ditto
current_padding = paddings[:, 0 : final_out.shape[1]] | ||
input_ts = final_out[:, -max_len:] | ||
input_padding = current_padding[:, -max_len:] | ||
fprop_outputs, all_attentions, all_hidden_states = self.forward(input_ts, input_padding, freq, output_attentions=output_attentions, output_hidden_states=output_hidden_states) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is caching being used to save on key value computations here? May be that is the purpose of output_attentions
and output_hidden_states
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required by the Hugging Face framework.
print(">>> TimesFMModel _preprocess", len(inputs), inputs[0].shape) | ||
input_ts, input_padding, inp_freq = [], [], [] | ||
|
||
pmap_pad = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this padding might not be required if we are not compiling the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it!
Great work! I left some minor comments. |
Would this PR add finetuning support for the model? |
What does this PR do?
This PR adds a new model, TimesFM, to HuggingFace. TimesFM is a time series forecasting model based on the transformer architecture. It was proposed in A decoder-only foundation model for time-series forecasting.
Code Example
TODOs