Skip to content

Conversation

Nazim-crim
Copy link
Contributor

@Nazim-crim Nazim-crim commented Jul 18, 2025

Description

  • This MR introduces the from_torch function in torch/ a utility to programmatically generate a STAC Item with the Machine Learning Model (MLM) Extension from a PyTorch nn.Module.
  • Add an exemple json of a parsed torchgeo unet using SENTINEL2_2CLASS_NC_FTW default weights

Related Issue

Type of Change

  • 📚 Examples, docs, tutorials or dependencies update;
  • 🔧 Bug fix (non-breaking change which fixes an issue);
  • 🥂 Improvement (non-breaking change which improves an existing feature);
  • 🚀 New feature (non-breaking change which adds functionality);
  • 💥 Breaking change (fix or feature that would cause existing functionality to change);
  • 🔐 Security fix.

Checklist

  • I've read the CONTRIBUTING.md guide;
  • I've updated the code style using make check;
  • I've written tests for all new methods and classes that I created;
  • I've written the docstring in Google format for all the methods and classes that I used.

@Nazim-crim
Copy link
Contributor Author

Following previous comment on crim-ca/mlm-extension#41 , here's my up to date change. Let me know if other fixes are needed. Thanks

@fmigneault fmigneault requested review from rbavery and fmigneault and removed request for rbavery July 19, 2025 02:55
pyproject.toml Outdated
@@ -13,7 +13,7 @@ authors = [
{name = "Francis Charette-Migneault", email = "francis.charette-migneault@crim.ca"},
]
license = {text = "Apache Software License 2.0"}
requires-python = "<4.0,>=3.10"
requires-python = "<4.0,>=3.11"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self Note

Merge other features and release MLM 1.5.0 & stac_model 0.4.0 before merging this to avoid the potentially breaking change for users employing the package.

CHANGELOG.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-note

Make sure the items are ordered correctly considering the intermediate release of MLM / stac_model.

@Nazim-crim Nazim-crim requested a review from fmigneault August 12, 2025 19:44
@fmigneault fmigneault mentioned this pull request Aug 13, 2025
11 tasks
@fmigneault
Copy link
Collaborator

@Nazim-crim
The linting check fails for the same reason as moregeo-it/stac-node-validator#78 (see the run outputs that converts 0.0 -> 0 and 3000.0 -> 3000). Since there is no planed fix for it, can you try to explicitly use int values and see if that patches the example?

The other failures for Python 3.10 should be handled properly when merging with #97.

@fmigneault
Copy link
Collaborator

fmigneault commented Aug 20, 2025

Temp fix for STAC validation is to used stac_version: 1.0.0 instead of 1.1.0.

@Nazim-crim Nazim-crim requested a review from fmigneault August 20, 2025 20:14
@fmigneault
Copy link
Collaborator

fmigneault commented Aug 20, 2025

See # pragma: has-torch for conditional resolution of 3.10 coverage.

has-torch = "is_installed('torch')"

@Nazim-crim Nazim-crim requested a review from fmigneault August 21, 2025 14:11
@fmigneault fmigneault merged commit a235e39 into stac-extensions:main Aug 21, 2025
5 checks passed
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.

Request inference example in pytorch/lightning
2 participants