Skip to content

Commit

Permalink
update json schema, note when the mlm:artifact type is required by ml…
Browse files Browse the repository at this point in the history
…m:model role
  • Loading branch information
rbavery committed Dec 13, 2024
1 parent 3cb4e05 commit 4c1c63a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ In order to provide more context, the following roles are also recommended were
| href | string | URI to the model artifact. |
| type | string | The media type of the artifact (see [Model Artifact Media-Type](#model-artifact-media-type). |
| roles | \[string] | **REQUIRED** Specify `mlm:model`. Can include `["mlm:weights", "mlm:checkpoint"]` as applicable. |
| mlm:artifact_type | [Artifact Type](#artifact-type) | Specifies the kind of model artifact. Typically related to a particular ML framework. |
| mlm:compile_method | string | Describes the method used to compile the ML model at either save time or runtime prior to inference. These options are mutually exclusive `["aot", "jit"]`. |
| mlm:artifact_type | [Artifact Type](#artifact-type) | Specifies the kind of model artifact. Typically related to a particular ML framework. This is **REQUIRED** if the `mlm:model` role is specified. |
| mlm:compile_method | string | Describes the method used to compile the ML model at either save time or runtime prior to inference. These options are mutually exclusive `["aot", "jit", null]`. |

Recommended Asset `roles` include `mlm:weights` or `mlm:checkpoint` for model weights that need to be loaded by a
model definition and `mlm:compiled` for models that can be loaded directly without an intermediate model definition.
Expand Down Expand Up @@ -710,8 +710,9 @@ The `mlm:artifact_type` field can be used to clarify how the model was saved whi
what runtime contexts it should be used. For example, PyTorch offers [various strategies][pytorch-frameworks] for providing model
definitions, such as Pickle (`.pt`), [TorchScript][pytorch-jit-script], or [PyTorch Ahead-of-Time Compilation][pytorch-aot-inductor]
(`.pt2`) approach. Since they all refer to the same ML framework, the [Model Artifact Media-Type](#model-artifact-media-type) can be
insufficient in this case to detect which strategy should be used to employ the model definition. See the [the best practices
document](./best-practices#framework-specific-artifact-types) on suggested fields for framework specific artifact types.
insufficient in this case to detect which strategy should be used to employ the model definition.
See the [the best practices document](./best-practices#framework-specific-artifact-types) on suggested
fields for framework specific artifact types.


### Source Code Asset
Expand Down
22 changes: 19 additions & 3 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@
},
"mlm:artifact_type": {
"$ref": "#/$defs/mlm:artifact_type"
},
"mlm:compile_method": {
"$ref": "#/$defs/mlm:compile_method"
}
},
"$comment": "Allow properties not defined by MLM prefix to work with other extensions and attributes, but disallow undefined MLM fields.",
Expand All @@ -324,7 +327,8 @@
"required": [
"mlm:input",
"mlm:output",
"mlm:artifact_type"
"mlm:artifact_type",
"mlm:compile_method"
]
}
},
Expand Down Expand Up @@ -354,7 +358,8 @@
"anyOf": [
{
"required": [
"mlm:artifact_type"
"mlm:artifact_type",
"mlm:compile_method"
]
}
]
Expand Down Expand Up @@ -460,7 +465,18 @@
"examples": [
"torch.save",
"torch.jit.save",
"torch.export.save"
"torch.export.save",
"tf.keras.Model.save",
"tf.keras.Model.save_weights",
"tf.saved_model.export(format='tf_saved_model')"
]
},
"mlm:compile_method": {
"type": "string",
"minLength": 1,
"examples": [
"aot",
"jit"
]
},
"mlm:tasks": {
Expand Down

0 comments on commit 4c1c63a

Please sign in to comment.