Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mlm:artifact_type check missing in assets and other disallowed MLM fields #59

Merged
merged 24 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ef82f26
fix mlm:artifact_type check missing + update corresponding tests/exam…
fmigneault Nov 1, 2024
caa8597
ignore typing in tests
fmigneault Nov 1, 2024
2414075
more test typing ignore
fmigneault Nov 1, 2024
a3fe806
Merge branch 'main' into fix-mlm-artefact
fmigneault Nov 5, 2024
248fd25
Merge branch 'main' into fix-mlm-artefact
fmigneault Nov 5, 2024
b98a7c4
more strict validation of MLM-prefixed fields under Assets and Item p…
fmigneault Nov 6, 2024
28c2983
ignore typing errors from mypy in tests
fmigneault Nov 6, 2024
8e56578
Merge branch 'main' into fix-mlm-artefact
fmigneault Nov 6, 2024
1f53bfa
add more tests to validate MLM fields disallowed under Asset
fmigneault Nov 6, 2024
007176a
add more explicit indication about Item-only vs shared Item/Asset MLM…
fmigneault Nov 6, 2024
2b06e30
fix brackets for markdown rendering
fmigneault Nov 6, 2024
66a9051
add more explicit indication about Item-only vs shared Item/Asset MLM…
fmigneault Nov 6, 2024
e8f785b
patch markdown linting of special header
fmigneault Nov 6, 2024
abf4a5e
patch markdown again
fmigneault Nov 6, 2024
778865a
use actual notes
fmigneault Nov 6, 2024
282fc4a
refactor the schema to replicate behavior of disallowed fields with J…
fmigneault Nov 7, 2024
bcfb82a
adjust test asset to be more adaptable to future schema changes
fmigneault Nov 7, 2024
7afb188
ignore test typing issues related to JSON manipulation
fmigneault Nov 7, 2024
3bcdb87
adjust pydantic fields attributes
fmigneault Nov 7, 2024
1dcbac8
update packages
fmigneault Nov 7, 2024
d4f8c48
ignore inconsistent pydantic/mypy typing between versions
fmigneault Nov 7, 2024
ec4430c
Merge branch 'main' into fix-mlm-artefact-v2
fmigneault Nov 7, 2024
139f3af
Merge remote-tracking branch 'origin/main' into fix-mlm-artefact-v2
fmigneault Nov 13, 2024
c6403f4
fix unused typing ignore error from mypy
fmigneault Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
for the entire input (but still possible).

### Changed
- Explicitly disallow `mlm:name`, `mlm:input`, `mlm:output` and `mlm:hyperparameters` at the Asset level.
These fields describe the model as a whole and should therefore be defined in Item properties.
- Moved `norm_type` to `value_scaling` object to better reflect the expected operation, which could be another
operation than what is typically known as "normalization" or "standardization" techniques in machine learning.
- Moved `statistics` to `value_scaling` object to better reflect their mutual `type` and additional
Expand All @@ -34,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Otherwise, the amount of `value_scaling` objects should match the number of bands or channels involved in the input.

### Fixed
- Fix missing `mlm:artifact_type` property check for a Model Asset definition
(fixes <https://github.com/stac-extensions/mlm/issues/42>).
The `mlm:artifact_type` is now mutually and exclusively required by the corresponding Asset with `mlm:model` role.
- Fix check of disallowed unknown/undefined `mlm:`-prefixed fields
(fixes [#41](https://github.com/stac-extensions/mlm/issues/41)).

Expand Down
86 changes: 50 additions & 36 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/item_bands_expression.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"$comment": "Following 'eo:bands' is required to fulfil schema validation of 'eo' extension.",
"eo:bands": [
{
Expand Down
3 changes: 2 additions & 1 deletion examples/item_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"type": "text/html",
"roles": [
"mlm:model"
]
],
"mlm:artifact_type": "torch.save"
}
},
"links": [
Expand Down
2 changes: 1 addition & 1 deletion examples/item_eo_and_raster_bands.json
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"$comment": "Following 'eo:bands' is required to fulfil schema validation of 'eo' extension.",
"eo:bands": [
{
Expand Down Expand Up @@ -557,7 +558,6 @@
"description": "Source code to run the model.",
"type": "text/x-python",
"roles": [
"mlm:model",
"code",
"metadata"
]
Expand Down
1 change: 1 addition & 0 deletions examples/item_eo_bands.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"$comment": "Following 'eo:bands' is required to fulfil schema validation of 'eo' extension.",
"eo:bands": [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/item_eo_bands_summarized.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"$comment": "Following 'eo:bands' is required to fulfil schema validation of 'eo' extension.",
"eo:bands": [
{
Expand Down Expand Up @@ -426,7 +427,6 @@
"description": "Source code to run the model.",
"type": "text/x-python",
"roles": [
"mlm:model",
"code",
"metadata"
]
Expand Down
1 change: 1 addition & 0 deletions examples/item_multi_io.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"raster:bands": [
{
"name": "B02 - blue",
Expand Down
1 change: 1 addition & 0 deletions examples/item_raster_bands.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
"mlm:model",
"mlm:weights"
],
"mlm:artifact_type": "torch.save",
"raster:bands": [
{
"name": "B01",
Expand Down
Loading