Skip to content

68 replace month pe#71

Open
meiertgrootes wants to merge 24 commits into
mainfrom
68_replace_month_pe
Open

68 replace month pe#71
meiertgrootes wants to merge 24 commits into
mainfrom
68_replace_month_pe

Conversation

@meiertgrootes

Copy link
Copy Markdown
Collaborator

This PR replace the PE based month encoding which was based off of sequence position with a time stamp based cyclical phase encoding of the month, creating a projected embedding from a C12 group fourier base embedding.

Note @SarahAlidoost @rogerkuou , as Levante is down and I do not have the appropriate data files locally I HAVE NOT been able to run the example note books.

Please consider doing so during review. Should errors occur feel free to just drop it back to me

@meiertgrootes meiertgrootes requested review from SarahAlidoost and rogerkuou and removed request for SarahAlidoost July 9, 2026 12:02
months.
"""

def __init__(self, embed_dim=128, max_months=12, dropout=0.0):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def __init__(self, embed_dim=128, dropout=0.0):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

removing leftover max_months=12,

Comment on lines 334 to 336
month_emb = (token_emb_seq * day_w).sum(dim=3)

month_tokens = month_tokens + month_emb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
aggregated_month_embed = (token_emb_seq * day_w).sum(dim=3)
month_tokens = month_tokens + aggregated_month_embed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

because the variable name month_emb is used for something else in previous lines. Here I suggested to rename it in this line.

T: number of temporal tokens per month after temporal patching (Tp)
H: spatial height after spatial patching
W: spatial width after spatial patching
time_features: (B,M,T,2) containing cyclically phase encoded DOY and HOD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
time_features: (B,M,T,3) containing cyclically phase encoded MOY, DOY and HOD

@@ -629,14 +630,14 @@
embed_dim=128,
patch_size=(1, 4, 4),
max_months=12,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
max_months=12,

@@ -645,7 +646,6 @@
embed_dim: Dimension of the patch embedding
patch_size: Tuple of (T, H, W) patch sizes for temporal and spatial patching
max_months: Maximum number of months for temporal positional encoding

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
max_months: Maximum number of months for temporal positional encoding

Comment on lines 674 to 675
embed_dim=embed_dim,
max_months=max_months,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you please remove max_months=max_months,. I couldnot add it as code suggestion.

@SarahAlidoost SarahAlidoost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@meiertgrootes thanks, nice implementation and improvement! 🥇 I could run the notebook without any issue. I left some minor comments. This is ready to merge. I noticed the branch 68_replace_month_pe is based on branch in #64 . Let's merge #64 to main first before merging this to main.

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