Skip to content

Conversation

@kctezcan
Copy link
Contributor

Description

The new SSL modes need integration tests, this is one for JEPA.

Note that I had other PRs open, but those got complicated with other branches merged, opened a clean one again.

Issue Number

Closes #1516

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

@@ -0,0 +1,102 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

How much code duplication is here with the other integration tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quite a bit, a refactoring would be beneficial. Tim said we should initially copy-paste the tests and refactor later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you open an issue so that we track the refactoring

uv run --offline pytest ./integration_tests/small1_test.py --verbose -s
)
;;
integration-test-jepa)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we all add an integration-test-all that runs all integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes please

stream_name = self.stream_names[i_obs]
if cf.training_config.losses["LossPhysical"].weight > 0.0:
for i_obs, si in enumerate(cf.streams):
stream_name = self.stream_names[i_obs]
Copy link
Collaborator

Choose a reason for hiding this comment

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

i_obs -> i_stream

if "LossPhysical" in loss_calculators:
for i_obs, si in enumerate(cf.streams):
stream_name = self.stream_names[i_obs]
if cf.training_config.losses["LossPhysical"].weight > 0.0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes are just due to incomplete visibility on github?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added these weight > 0.0 checks to switch off the LossPhysical related parts of the code, otherwise it tries to use both losses because the configs are appending.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will break for latent SSL training without LossPhysical. So please use cf.training_config.get( "LossPhysical")

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am still confused by the large number of changes in model.py where I cannot see what actually changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for catching, switched to ``.get()`

losses_all[calculator.name] = loss_values.losses_all
losses_all[calculator.name]["loss_avg"] = loss_values.loss
stddev_all[calculator.name] = loss_values.stddev_all
if weight > 0.0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes appear just due to github?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

@kctezcan
Copy link
Contributor Author

@clessig have a look please

stream_name=f"embed_target_coords_{stream_name}",
)
else:
assert False
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: this is not informative. Can you either raise an exception with a full message or, if you prefer asserts, do :

assert etc["net"] in ["mlp", "linear"], etc["net"]
if etc["net"] == "linear":
  ...

then the value that is causing problem is clear

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's unrelated to the PR. We can do this as part of #1537

@tjhunter
Copy link
Collaborator

To be merged after @clessig 's work on the config. Looking forward to having a test for SSL

@@ -0,0 +1,102 @@
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you open an issue so that we track the refactoring

@clessig clessig merged commit 29e2fe2 into ecmwf:develop Jan 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add integration test for JEPA

3 participants