Skip to content

Feat/user data input - #128

Merged
Dinghye merged 13 commits into
mainfrom
feat/user-data-input
Aug 24, 2026
Merged

Feat/user data input#128
Dinghye merged 13 commits into
mainfrom
feat/user-data-input

Conversation

@Dinghye

@Dinghye Dinghye commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a bring-your-own-data path: users with their own imagery (local patches, exported GeoTIFFs, training cubes) can compute embeddings directly, with no provider fetch and no GEE auth.

What's in here

  • UserData declaration: register imagery once (pixels + collection + one band name per channel + optional spatial/temporal); the declaration, not the array shape, is the contract. bands may be omitted only for the canonical 12-band S2 L2A case; band identity is never guessed.
  • Matching with refusal semantics: superset band sets are sliced and reordered into model band order automatically (shared provider band-alias vocabulary, e.g. NIR_NARROW → B8A); a collection mismatch or missing band raises ModelError naming what is missing; precomputed models always refuse. list_models_for_data reports the verdict for every catalog model without loading weights.
  • Public API: get_embedding_from_data(model, data) / get_embeddings_batch_from_data(model, datas, batch_size=...); batch items carry their own spatial/temporal, dispatch grouped, results in input order. batch_size caps the per-forward batch for small GPUs.
  • input_prep="tile" default for fairness: arrays larger than a model's input size are cut into model-native tiles at native resolution and stitched, so a 256px patch reaches clay as one pass and galileo as a 4×4 grid of 64px tiles instead of losing 15/16 of its pixels to a resize; "resize" opts out.
  • Flexible-size models run natively: new EmbedderBase.resolve_input_image_size hook; olmoearth (FlexiViT) consumes any patch-divisible size as one seamless pass by default, warns above 512px (quadratic attention cost), and an explicit image_size restores fixed-size tiling.
  • New embedder flags/hooks (no model-name branches): _requires_georef (clay/prithvi refuse spatial-less data — coordinates are never fabricated), resolve_input_image_size, olmoearth tiled_dispatch_model_config.
  • Fix: clay's get_embeddings_batch_from_inputs no longer acquires a provider for prefetched inputs (it forced Earth Engine auth on GEE-less machines; single path already followed the lazy-provider convention).
  • Docs: new docs/user_data.md (site-style admonitions, complete GeoTIFF-to-embedding and directory-to-feature-matrix examples), Input size column in the models overview, CHANGELOG entries.

Testing

test_user_data_matching.py + test_api_from_data.py (mock embedders, no weights/network; list_models_for_data also exercised against the real catalog), clay/olmoearth regression tests, contract tests updated deliberately (tiled_dispatch registry now pins {thor, olmoearth}); affected suites incl. test_export_input_prep_consistency.py pass, ruff clean.

@Dinghye
Dinghye merged commit cc45692 into main Aug 24, 2026
7 checks passed
@Dinghye
Dinghye deleted the feat/user-data-input branch August 24, 2026 20:18
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.

1 participant