Skip to content
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

Split input_transform into context_input_transform and label_input_transform #82

Merged
merged 11 commits into from
May 28, 2024

Conversation

abdulfatir
Copy link
Contributor

@abdulfatir abdulfatir commented May 27, 2024

Description of changes: This splits input_transform into context_input_transform and label_input_transform. Previously, input_transform was being used for both context and label during training which would lead to incorrect results where prediction_length > context_length.

TODO:

  • Update docstrings
  • Test the training script

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@abdulfatir abdulfatir changed the title Add abstractions: Config, Tokenizer, Pipeline Split input_transform into context_input_transform and label_input_transform May 27, 2024
src/chronos/chronos.py Outdated Show resolved Hide resolved
src/chronos/chronos.py Show resolved Hide resolved
if length > self.config.context_length:
context = context[..., -self.config.context_length :]

token_ids, attention_mask, scale = self._input_transform(context=context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering: is _input_transform needed, or could context_input_transform just piggy-back on label_input_transform here?

Copy link
Contributor

@lostella lostella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a proposal for slightly shorter names. Don't hate me, names are hard:

  • context_input_transform -> encode_context
  • label_input_transform -> encode_label
  • output_transform -> decode_samples

What do you think? Of course if we change names then docstrings are to be updated

src/chronos/chronos.py Show resolved Hide resolved
@abdulfatir
Copy link
Contributor Author

In general, I don't disagree that names can be improved but I am wondering if encode and decode have other connotations, i.e., encoder and decoder in an encoder-decoder transformer model.

@abdulfatir abdulfatir merged commit 223e576 into amazon-science:main May 28, 2024
2 checks passed
@abdulfatir abdulfatir deleted the add-abstractions branch November 29, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants