Repository navigation
add mlm extension - #43
Conversation
|
I'm not quite sure what would need to be adjusted to handle the nested objects like datacube does?
|
|
Thanks, the extension label looks good to me. For the nested objects, nothing needs to change in the code. The formatter already recurses into "mlm:name": "Name",
"mlm:architecture": "Architecture",
"mlm:tasks": {
"label": "Tasks",
"format": "CSV"
},
"mlm:framework": "Framework",
"mlm:framework_version": "Framework Version",
"mlm:memory_size": {
"label": "Memory Size",
"format": "FileSize"
},
"mlm:total_parameters": "Total Parameters",
"mlm:pretrained": "Pretrained",
"mlm:pretrained_source": {
"label": "Pretrained Source",
"null": "none"
},
"mlm:batch_size_suggestion": "Suggested Batch Size",
"mlm:accelerator": {
"label": "Accelerator",
"null": "any"
},
"mlm:accelerator_constrained": "Accelerator Constrained",
"mlm:accelerator_summary": "Accelerator Summary",
"mlm:accelerator_count": "Accelerator Count",
"mlm:hyperparameters": {
"label": "Hyperparameters",
"summary": false
},
"mlm:input": {
"label": "Inputs",
"summary": false,
"items": {
"name": {
"label": "Name",
"id": true,
"order": 0
},
"description": {
"alias": "description",
"order": 1
},
"bands": {
"label": "Bands",
"order": 2,
"items": {
"name": {
"label": "Name",
"id": true
},
"format": {
"label": "Format",
"order": 1
},
"expression": {
"label": "Expression",
"order": 2
}
}
},
"variables": {
"label": "Variables",
"order": 3,
"items": {
"name": {
"label": "Name",
"id": true
},
"format": {
"label": "Format",
"order": 1
},
"expression": {
"label": "Expression",
"order": 2
}
}
},
"input": {
"label": "Structure",
"order": 4,
"properties": {
"shape": {
"label": "Size",
"format": "Shape"
},
"dim_order": {
"label": "Dimensions",
"format": "CSV"
},
"data_type": {
"alias": "data_type"
}
}
},
"value_scaling": {
"label": "Scale",
"order": 5,
"null": "none",
"items": {
"type": {
"label": "Type",
"null": "none",
"order": 0
},
"minimum": {
"label": "Min.",
"order": 1
},
"maximum": {
"label": "Max.",
"order": 2
},
"mean": {
"label": "Average",
"order": 3
},
"stddev": {
"label": "Std. Dev.",
"order": 4
},
"value": {
"label": "Value",
"order": 5
},
"format": {
"label": "Format",
"order": 6
},
"expression": {
"label": "Expression",
"order": 7
}
}
},
"resize_type": {
"label": "Resize Method",
"order": 6,
"null": "none"
},
"pre_processing_function": {
"label": "Processing Instructions",
"order": 7,
"null": "none",
"properties": {
"format": "Format",
"expression": "Expression",
"description": {
"alias": "description"
}
}
}
}
},
"mlm:output": {
"label": "Outputs",
"summary": false,
"items": {
"name": {
"label": "Name",
"id": true,
"order": 0
},
"description": {
"alias": "description",
"order": 1
},
"tasks": {
"alias": "mlm:tasks",
"order": 2
},
"bands": {
"label": "Bands",
"order": 3,
"items": {
"name": {
"label": "Name",
"id": true
},
"format": {
"label": "Format",
"order": 1
},
"expression": {
"label": "Expression",
"order": 2
}
}
},
"variables": {
"label": "Variables",
"order": 4,
"items": {
"name": {
"label": "Name",
"id": true
},
"format": {
"label": "Format",
"order": 1
},
"expression": {
"label": "Expression",
"order": 2
}
}
},
"result": {
"label": "Structure",
"order": 5,
"properties": {
"shape": {
"label": "Size",
"format": "Shape"
},
"dim_order": {
"label": "Dimensions",
"format": "CSV"
},
"data_type": {
"alias": "data_type"
}
}
},
"classification:classes": {
"alias": "classification:classes",
"order": 6
},
"post_processing_function": {
"label": "Processing Instructions",
"order": 7,
"null": "none",
"properties": {
"format": "Format",
"expression": "Expression",
"description": {
"alias": "description"
}
}
}
}
},
"mlm:artifact_type": "Artifact Type",
"mlm:compile_method": {
"label": "Compile Method",
"mapping": {
"null": "none",
"aot": "Ahead-of-Time (AOT)",
"jit": "Just-in-Time (JIT)"
}
},
"mlm:entrypoint": "Entrypoint"A few notes:
Feel free to add this to this PR. |
|
Oh and you can test it locally first in STAC Browser by using https://github.com/radiantearth/stac-browser/blob/main/docs/metadata.md#adding-custom-fields with the definitions you have for stac-fields. |
|
I've updated the definitions as suggested, and expanded them a bit more to further improve rendering. Using this reference as example: Outputs:
|
m-mohr
left a comment
There was a problem hiding this comment.
Thanks for expanding this! The definitions look good to me. I'm less sure about the new options and formatters, though. I don't plan to add new definition options in v1, but I'll rework some things in v2. If you want something to be remembered or addressed there, please open an issue.
New options:
orderon top-level fields isn't planned for now, so please remove it from the definitions,interface.jsand the README.tableneeds to go into the hard-coded list in STAC Browser for now: https://github.com/radiantearth/stac-browser/blob/main/src/components/metadata/MetadataEntry.vue
Feel free to open a PR there that addsmlm:inputandmlm:output.widthis client-specific and might not work well in other clients. Styling should be handled in the client, not in stac-fields.
Formatters:
ParameterCountalways uses English suffixes, e.g. "9,87M" in German.Intl.NumberFormatwithnotation: "compact"localizes this ("9,87 Mio." in German, "9,87 M" in French) and already uses "B" in English. I'd use that for a genericCompactNumberformatter, which other fields (e.g.pc:count) could use as well.ScientificNotationandMetricNotationaren't used by any field, so I'd remove them for now.
Definitions:
- Please move the
mlm:*fields from the core fields (betweenunpublishedandlicense) to the extension fields. These are roughly sorted alphabetically by prefix, with some proprietary fields at the end. mlm:tasksanddim_orderno longer have"format": "CSV", so they render as vertical lists in the table cells. Was that intentional?
|
@m-mohr Is it possible to have more details about the I've pushed all examples the MLM extension defines under https://hirondelle.crim.ca/stac-browser/collections/stac-mlm-examples to try exploring their representation, and I am finding more and more complex representations to consider as I go through them. For example, some have These
|
|
The table rendering approach is limited in STAC Browser unless you hardcode something more specific in STAC Browser (like the histogram charts in a table cell). I'd recommend to keep it simple for now until we have a better approach for it, hopefully in stac-fields v2. Then we'll migrate from HTML rendering to Vue-based rendering and can go arbitrarily complex. To enforce a tabular rendering, you'd need to enforce it in STAC Browser as well, see above. Disclaimer: It's 4am, I'm not sure I got all your message right 😅 Good night! |
|
Another quick note: for very complex data it could make sense to not use stac-fields for rendering but to make a custom implementation in STAC Browser for that extension that renders separately from the metadata and then hide the respective fields in STAC Browser metadata. We already do that for a selected set of extensions where it makes more sense to show it separately and not in metadata blocks. |
|
Sorry, I think we talked past each other. The Bands table is the stac-fields approach: the columns come from the The only catch is that STAC Browser only switches to a table automatically when a field has 3 or more entries, so most MLM inputs and outputs would show as lists. That's why they need to be added to The custom implementation I mentioned (a separate component, with the fields hidden from the metadata) is only a fallback if the tables don't work well enough. If you're happy with them, we don't need it. Next steps:
|
|
@m-mohr The |
| } | ||
|
|
||
| const formatted = new Intl.NumberFormat(I18N.locales, { | ||
| notation: "compact", |
There was a problem hiding this comment.
| notation: "compact", | |
| notation: "compact", | |
| compactDisplay: "long", |
I think the long notation is a little less technical and better to understand for the average user.
| "mlm:pretrained": { | ||
| "label": "Pretrained", | ||
| "explain": "Indicates if the model was pretrained. If the model was pretrained, consider providing pretrained_source if it is known." | ||
| }, |
There was a problem hiding this comment.
The explain mostly repeats the label and guides data providers, which doesn't help users. I'd remove it:
| "mlm:pretrained": { | |
| "label": "Pretrained", | |
| "explain": "Indicates if the model was pretrained. If the model was pretrained, consider providing pretrained_source if it is known." | |
| }, | |
| "mlm:pretrained": "Pretrained", |
There was a problem hiding this comment.
Maybe a clearer wording would be "whether this model used another source as pretraining".
The idea is really to illustrate "training from scratch or from a foundation model".
It is kind of hard to indicate clearly because mlm:pretrained_source is omitted entirely if not, so its label won't show.
| }, | ||
| "mlm:pretrained_source": { | ||
| "label": "Pretrained Source", | ||
| "explain": "The source of the pretraining. Can refer to popular pretraining datasets by name (i.e. Imagenet) or less known datasets by URL and description. If trained from scratch (i.e.: pretrained = false), the null value should be set explicitly.", |
There was a problem hiding this comment.
This is guidance for data providers. The value is self-explanatory and null is already covered by the null option, so I'd remove the explain:
| "explain": "The source of the pretraining. Can refer to popular pretraining datasets by name (i.e. Imagenet) or less known datasets by URL and description. If trained from scratch (i.e.: pretrained = false), the null value should be set explicitly.", |
There was a problem hiding this comment.
I agree if the wording (eg: #43 (comment)) was improved.
The potential confusion I was trying to avoid is for users to think that this model is "not yet trained" vs "was trained / ready for inference", which is not the correct interpretation. I think "pretrained" is correctly understood by ML practitioners, but I'm not sure for other users.
| "mlm:batch_size_suggestion": "Suggested Batch Size", | ||
| "mlm:accelerator": { | ||
| "label": "Accelerator", | ||
| "explain": "The intended computational hardware that runs inference. If undefined or set to null explicitly, the model does not require any specific accelerator.", |
There was a problem hiding this comment.
I'd phrase this from a user's perspective and drop the null part, which is already covered by "any":
| "explain": "The intended computational hardware that runs inference. If undefined or set to null explicitly, the model does not require any specific accelerator.", | |
| "explain": "The hardware that the model is intended to run on", |
There was a problem hiding this comment.
Works for me. You can apply in other PR as desired.
| }, | ||
| "mlm:accelerator_constrained": { | ||
| "label": "Accelerator Constrained", | ||
| "explain": "Indicates if the intended accelerator is the only accelerator that can run inference. If undefined, it should be assumed false." |
There was a problem hiding this comment.
I'd phrase this from a user's perspective. Fields that aren't set aren't shown, so the part about undefined values isn't needed:
| "explain": "Indicates if the intended accelerator is the only accelerator that can run inference. If undefined, it should be assumed false." | |
| "explain": "Whether the model can only run on the specified accelerator" |
There was a problem hiding this comment.
This rewording works.
There was a problem hiding this comment.
Thanks for the updates. The changes are mostly fine. Some proposed changes above. The addition of OrderedList is fine.
An alternative for dim_order could be "format": "Shape", which would render it as "batch × variables × rlat × rlon", in line with the size above it. What do you think? I'm fine with either.
Isn't formatMLMOutputTasks reduntant right now?
|
Thanks a lot for all the work on this, @fmigneault! I'd like to release STAC Browser v5.2.1 soon and include the MLM support, which needs a new stac-fields release first. As I can't push to your fork, I'll squash-merge this PR as it is and apply the remaining review suggestions afterwards directly on main. In STAC Browser, I've extracted the |
Maybe something like Indeed, |




Technical Context
Description
Add the short label definition for MLM extension.
Checklist
README.mdto reflect any new environment variables, configuration changes, or breaking updates.AI tool usage