[WIP] Feature/swin transformer#1207
Open
yyexela wants to merge 51 commits into
Open
Conversation
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>
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.
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 featureCan 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)