HEALPix UNet code cleanup#1326
Draft
yikwill wants to merge 3 commits into
Draft
Conversation
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.
Several HEALPix settings were duplicated across YAML configs, mutated at build time, or lived on monolithic dataclasses where variant-specific fields were silently ignored. This PR makes configs easier to load from YAML, reason about, and extend. It refactors HEALPix UNet configuration and build path to address feedback from a previous HEALPix PR. Block configs are split into dacite discriminated unions and runtime/build-time concerns are separated.
Changes:
Build-time vs config-time separation
input_channels/output_channels) have been removed fromUNetEncoderConfig,UNetDecoderConfig, and conv/downsample/upsample block configs. Insteady, they are now passed explicitly to.build()fromHEALPixUNet/HEALPixUNetBuilder..replace) when constructing the model.Shared build context
HEALPixBuildContextandHEALPixLayerBuildContextfor model-level settings (hpx_padding_mode,nsideper level). They are configured once onHEALPixUNet/HEALPixUNetBuilder, then the encoder, decoder, and blocks receive per-level views viactx.layer(level).Discriminated union block configs
block_type, each with aLiteral[...]discriminator for dacite union resolution. For example, the union aliasDownSamplingBlockConfighas variantsMaxPoolDownsamplingBlockConfig,AvgPoolDownsamplingBlockConfig, andDealiasedDownsampleBlockConfig. Each variant exposes only fields relevant to that block type.Other
enable_nhwcoption removed. Memory format of inputs is already hard coded.Replace
thcalls withtorchfor clarity.Tests added
If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated