Build target mask for streams with empty target channels - #2737
Merged
Jubeku merged 10 commits intoAug 7, 2026
Conversation
…o jk/develop-ssl-diffusion-v1/fix-streams
4 tasks
Jubeku
marked this pull request as ready for review
August 7, 2026 04:49
Contributor
Author
Contributor
Author
| # determine if forcing dataset => mask is empty | ||
| if is_stream_forcing(stream_info, self.stage): | ||
| target_mask, mask_params = torch.zeros(num_cells, dtype=torch.bool), {} | ||
| # A forcing stream (e.g. observations with ``target: []``) produces no |
Contributor
There was a problem hiding this comment.
I don't think this breaks anything. JEPA would run without stream forcing at the moment and that code path is the same. When we set stream forcing it should also now have the same code path (here locally, unsure about elsewhere), as without it, which is sensible. Overall this feels like quite a bit of code duplication and at some point we should revisit this logic. I wouldn't block the PR because of it, but create an issue to remind ourselves that this needs clean-up.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains 2 fixes related to multi-stream inputs:
1. Empty target channels
For multi-stream inputs (i.e. ERA5+Obs) we need to make sure that
Forcing: Falsein the input streams (otherwise are not encoded as latent target). Additionally, we might want to settargets: []to save memory (especially for ERA5 N320; only source channels in the target batch are used for the latent target) - however, empty targets lead to an empty target mask which leads to the stream being ignored in the latent target.This PR generates the target mask in
latent_lossandstudent_teachermode despite emptytargets: [].2. Consistent random number (from @kctezcan)
Problem: the random number used to make the noise signal for the diffusion forward process is coming from the source random draw. the random number for calculating the loss weight for diffusion is coming from the target random draw.
Fix: take the arget random number also for the source.
Remark: for this to work, the
target_inputin the config has to be set:Description
Issue Number
Is this PR a draft? Mark it as draft.
Checklist before asking for review
./scripts/actions.sh lint./scripts/actions.sh unit-test./scripts/actions.sh integration-testlaunch-slurm.py --time 60