Skip to content

[WIP] Feature/swin transformer#1207

Open
yyexela wants to merge 51 commits into
mainfrom
feature/swin_transformer
Open

[WIP] Feature/swin transformer#1207
yyexela wants to merge 51 commits into
mainfrom
feature/swin_transformer

Conversation

@yyexela

@yyexela yyexela commented May 29, 2026

Copy link
Copy Markdown
Contributor

Working on swin transformer


Short description of why the PR is needed and how it satisfies those requirements, in sentence form.

Changes:

  • symbol (e.g. fme.core.my_function) or script and concise description of changes or added feature

  • Can group multiple related symbols on a single bullet

  • Tests added

  • If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated

Resolves # (delete if none)

mcgibbon and others added 30 commits May 26, 2026 15:30
Extracts global mean removal from the normalizer into a separate
transform that wraps SingleModuleStep, supporting shared-reference
and per-channel modes with optional extra input channels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ed field names

Remove dead from_state method on GlobalMeanRemovalConfig. Update
docstrings to explain that output-only fields are intentionally
un-shifted by inverse_transform (the network learns to compensate
via end-to-end training). Log a warning when field_names entries
appear in neither in_names nor out_names.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move result tensors to CPU before comparing with CPU-created expected
tensors, fixing failures on GPU CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…onfig ABC

Corrector, ocean, and prescribed prognostics now run in physical space
(after inverse_transform) when global_mean_removal is active, so they
see un-shifted values. Remove the unused GlobalMeanRemovalConfig ABC
since only the union type is used in type hints.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Moves forward_transform/inverse_transform into step_with_adjustments so
corrector/ocean/prescribed adjustments stay in one place instead of being
duplicated outside. Adds NoGlobalMeanRemoval null class to eliminate the
forked code path in SingleModuleStep.step(). Fixes device mismatch in
test_per_channel_masked_uses_zero by moving data_mask to the test device.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The per-channel forward_transform was subtracting each field's
per-sample spatial mean in physical space, leaving a post-normalization
bias of -clim_mean/clim_std on every input pixel. For fields with
significant climatology means (e.g. absolute temperatures) this fed
the network large constant offsets and produced NaNs during training.

Shift each field by clim_mean - sample_mean instead, mirroring the
shared variant, so the post-normalization spatial mean is approximately
zero. For masked samples the shift is zero (no forward or inverse
shift), and the extra-channel formula becomes -shift/std (the anomaly
for unmasked samples, zero for masked).

Add regression tests that assert the post-normalization spatial mean
is ~0 with realistic climatologies, including the masked case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
StepMeanMetricConfig wrapped its aggregator with VariableFilterAdapter,
which filtered variables out of record_batch input. This starved the
inner MeanAggregator of variables needed for channel_mean computation,
raising KeyError when channel_mean_names referenced variables not in
the filtered subset.

Replace input-level filtering with output-level filtering: add a
report_variables parameter to MeanAggregator and _EnsembleAggregator
that computes metrics over all variables but only includes the
requested subset in get_logs/get_dataset output. Aggregate entries
like channel_mean are always included.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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