Repository navigation
Run a compiled CNN on pinned Sentinel-2 images, with a float64 check for final outputs where float32 PyTorch is itself outside 1e-4 - #53
Merged
Conversation
…p, input check before any model export, compare on the fetched input, an offline map A recipe may declare an imagery input convention (collection, bands per image, number of images, divisor); the trained Fields of The World recipe declares its release's. The image IDs and the chip's grid are run arguments. With them: discover lists a day's images in one request; the input image is exported from the pinned images, cast to float32 last, nothing filled; check-input fetches it once with a validity band and records what it is; run submits no model export without that record, or with a masked pixel; compare's reference is PyTorch on the fetched array; map draws the images and the predicted classes offline. A staged run with an imagery input adopts only the tables of an earlier upload and saves its own input. Without image arguments every request and plan is unchanged. The input export is one implementation for the numerical chip and for imagery; a refused input export is no longer passed over when upload is run again.
…Torch is itself more than 1e-4 from it The compiled-CNN run tool's compare computes both references, chooses the check from them alone and records it with all three largest absolute errors.
…ups, the input and six exports, the logits judged against float64 PyTorch
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.
Two things: a rule for a model's final output where float32 PyTorch cannot serve as the 1e-4 reference, and an input read from catalogue images in the compiled-CNN run tool, with the record of one live run of the released Fields of The World v3.1 U-Net on a real Sentinel-2 chip.
No block, record, status, default, golden file or catalogue row changes.
The rule change (
CONTRIBUTING.md,AGENTS.md)The 1e-4 target against float32 PyTorch stays for block fixtures and for a model's final outputs. One case is added, by the maintainer's decision:
model.double()) is checked as an intermediate output already is: its largest absolute error against float64 must be no larger than float32 PyTorch's own.On the chip of this pull request float32 and float64 PyTorch differ by 1.83e-04 (63 of 196,608 values over 1e-4), so this check decided the run. The rule and the tool's comparison were committed, and the gates run, before the model exports were submitted and before any logit was fetched.
The tool (
tools/compiled_cnn_run.py)Recipe.imagery: collection, bands per image, image count, divisor). The image IDs and the chip's grid are run arguments (--images,--crs,--origin,--pixel-size, all four together). The trained recipe declares its release's convention: twoCOPERNICUS/S2_SR_HARMONIZEDimages, B4, B3, B2, B8 of each, divided by 3000.discover: onecomputeValueper call, no task or asset. It lists a day's images whose footprint contains the chip, with tile, cloud percentage, processing baseline and whether the chip's pixels are pixels of the band.check-input: onecomputePixelsof the saved input with a validity band.runsubmits no model export without its record, or with a masked pixel, or with a fetch that is not finite float32 of the chip's shape.compare: computes float32 and float64 PyTorch, chooses the check from them (judged), and records the check, the three largest absolute errors, the counts over 1e-4, the float32 step at the largest reference, and the class agreement against both. On imagery the references are computed on the arraycheck-inputkept. A record from before this change prints as it did.map: offline, the images in true colour next to the predicted classes.uploadand the upload marked verified (_Command.input_imageis shared by both paths).tools/prithvi_real_input.py:day_imagesfactored out ofdiscover_expressionfor reuse; its expression is unchanged.Base revision:
40b0e11(main).Changes by layer
tools/compiled_cnn_run.py,tools/prithvi_real_input.py.tests/test_compiled_cnn_run.py(against fake clients; zero cloud calls).CONTRIBUTING.md("Numerical comparisons", one item),AGENTS.md("Numerical claims", two sentences).docs/evidence/compiled-cnn-ftw-v31-sentinel2-live.json(the tool'sreportoutput, unedited) and the twodiscoveroutputs,docs/evidence/compiled-cnn-ftw-v31-sentinel2-discover-2021-06-17.jsonand…-2021-09-25.json.Checks on the head commit
Run locally on
198da8fwith a clean tree (Python 3.14, all extras, trained checkpoints present):pytest -q: 4262 passed, 21 skipped.compiled_cnn_run.py plan, for the four selections that ran live earlier (one request and staged, both recipes): byte-identical to the base revision's, in JSON and in text.reporton the four run directories: the one-request record, the trained record and this pull request's record come out byte-identical to the committed files. The deterministic-weights record differs only in the class-agreement text that Run compiled CNNs in stages: saved nodes in compile_model, a run tool, and live runs of an EfficientNet-B3 U-Net #52 already noted.segmentation-models-pytorch(hidden behind an import blocker) and without a resources checkout:tests/test_compiled_cnn_run.pyandtests/test_compile_saved_nodes.pytogether give 86 passed, 4 skipped.live_fixtures.py --offlineand--plan: not run. No fixture or selection is added or changed, so there is no mirror-against-PyTorch figure to report.Not reproduced locally: the hosted jobs on Python 3.11 and 3.12 without extras.
The live run
One 256 × 256 chip at 10 m (EPSG:32633, upper-left corner 361120, 5335910) of Sentinel-2 tile 33UUP, from the acquisitions of 17 June and 25 September 2021. Each lookup returned exactly one image, with the chip on the image's own pixels and cloud cover of 0.22% and 0.0004% of the tile. The run was at
5c29e8eon a clean tree (the record carries no revision), staged with thefeaturescut list and a path bound of 1,600, and read the weight tables of the earlier trained run. Limits as prepared: budget 600 EECU-seconds, 900 s per task, 1,800 s in the queue.Six
exportImagecalls for the model, none repeated, no cancel. The fetched input was float32 and finite with no masked pixel.What the run shows, and what it does not
Limitations
discoverreports each image's grid for that reason.compare, in float64, on the CPU.Open questions
docs/vit-b16-dpt224.mdand the other model pages state "1e-4 against float32 PyTorch" for final outputs without the new case. They stay true for the outputs they describe; whether to add a pointer is left open.compile_model's docstring still lists two staged live runs ofsaved_nodes; this run is a third, on the same architecture and cut list. Not edited here.