Skip to content

Fix geo embeding - #92

Draft
SarahAlidoost wants to merge 16 commits into
mainfrom
fix_geo_embeding
Draft

Fix geo embeding#92
SarahAlidoost wants to merge 16 commits into
mainfrom
fix_geo_embeding

Conversation

@SarahAlidoost

@SarahAlidoost SarahAlidoost commented Aug 28, 2026

Copy link
Copy Markdown
Member

closes #91

The main changes in this PR:

  • fixing the calculation of geo embeding for each patch in dataset class
  • removing the SpatialTransfoemr
  • Other changes (minor) in the class st_encoder_decoder is mainly improving model performance.

Todo:

@SarahAlidoost

Copy link
Copy Markdown
Member Author

@meiertgrootes and @rogerkuou This PR fixes #91. Regarding the model performance see #93. Please let me know if something isnot clear.

@SarahAlidoost SarahAlidoost mentioned this pull request Sep 1, 2026

@rogerkuou rogerkuou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @SarahAlidoost , I had a look at the changes and they all look good! I haven't executed notebooks and I am planning to do it when Levante is back online.

I just have one tiny comment on the notwbook. Feel free to ignore.

Another general comment is, is this PR also aim to rename the daily/hourly variables to input? If this is the case, there are still many instances in dataset.py and st_encoder_decode.py, like these lines, but it seems you also get this tracked in your thirs point in issue #93

Comment thread notebooks/example_hourly.ipynb
@SarahAlidoost

SarahAlidoost commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Hi @SarahAlidoost , I had a look at the changes and they all look good! I haven't executed notebooks and I am planning to do it when Levante is back online.

@rogerkuou Hi, Thanks!, you can run the daily example notebook locally, I made the spatial subset even smaller, so it takes a few seconds for training loop to complete. Can you please run the notebook and see whether results, and the workflow are all good?

I just have one tiny comment on the notwbook. Feel free to ignore.

Another general comment is, is this PR also aim to rename the daily/hourly variables to input? If this is the case, there are still many instances in dataset.py and st_encoder_decode.py, like these lines, but it seems you also get this tracked in your thirs point in issue #93

Correct! in this PR I didn't want to rename daily/hourly. Renaming variables is mentioned in issue #67 which I think it is not the priority now. But the third point in issue #93 is about the type of input (i.e. SST or anomaly), whether daily or hourly.

@meiertgrootes meiertgrootes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Also waiting on Levante to run, but the adaptations make sense. Removing the spatial transformer does potentially loose some spatial correlation information, however, as we are temporally aggregating beforehand anyway that is likely not so critical. And it does alleviate the crop size dependence.

One very minor point on the tuning configuration.

Go ahead and merge when you see fit.

Comment thread climanet/tune.py
time_features=time_features,
land_mask=ray.get(data_config["land_mask_data"]),
patch_size=data_config["patch_size"], # based on the patch_size in model
crop_size=data_config["crop_size"], # based on the patch_size in model

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please ignore if I just overlooked it, but I can't find the adapted keywords for the data_config in tuning.py

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that's right. I was waiting for #25 to be merged and then update the scripts, see my Todo list here.

@SarahAlidoost

Copy link
Copy Markdown
Member Author

Looks good to me. Also waiting on Levante to run, but the adaptations make sense. Removing the spatial transformer does potentially loose some spatial correlation information, however, as we are temporally aggregating beforehand anyway that is likely not so critical. And it does alleviate the crop size dependence.

Yes, that's correct. I think training on the whole globe should help the model learn the spatial correlations. Once it's trained, we can check this and maybe add a spatial mixing layer in the decoder if needed 🤔 I'll add it to issue #93 so we don't forget.

One very minor point on the tuning configuration.

Go ahead and merge when you see fit.

Comment thread scripts/run_best_tuned_model.py
@rogerkuou

Copy link
Copy Markdown
Collaborator

Hi @SarahAlidoost , I had a look at the changes and they all look good! I haven't executed notebooks and I am planning to do it when Levante is back online.

@rogerkuou Hi, Thanks!, you can run the daily example notebook locally, I made the spatial subset even smaller, so it takes a few seconds for training loop to complete. Can you please run the notebook and see whether results, and the workflow are all good?

I just have one tiny comment on the notwbook. Feel free to ignore.
Another general comment is, is this PR also aim to rename the daily/hourly variables to input? If this is the case, there are still many instances in dataset.py and st_encoder_decode.py, like these lines, but it seems you also get this tracked in your thirs point in issue #93

Correct! in this PR I didn't want to rename daily/hourly. Renaming variables is mentioned in issue #67 which I think it is not the priority now. But the third point in issue #93 is about the type of input (i.e. SST or anomaly), whether daily or hourly.

Hi @SarahAlidoost , I did a local run with the hourly training example notebook, see this GH gist.

My observations:

  • The training runs smoothly, with a similar result as yours. (see the end errors and histogram)
  • However I only managed to run ~1/8 of your AoI. it runs much slower on my local comparing with your time profiling results in the example. I increased the training workers to 8 and data loading workers to 4. This took ~1hr.
  • Batch size 10 is about to the max my me can hold.
  • I used month 202101 for both training and validation. And 202202 for testing. since I only got two months file on my local

With this I think this PR is ready for another training run. The sloweness issue is likely to be caused by my local infra.

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.

Bug in dataset when calculating geo_pos_embedding_patch

3 participants