ArtifactSchemaDataset
- pydantic model mlopus.kedro.ArtifactSchemaDataset[source]
Bases:
MlflowRunMixin
,EmptyStrAsMissing
,EmptyDictAsMissing
,ExcludeEmptyMixin
,AbstractDataset
[A
,A
],Generic
[A
,D
,L
]Saves/loads data using inferred or explicitly specified artifact schema.
See also
Usage with explicit schema
# conf/<env>/catalog.yml model: type: mlopus.kedro.ArtifactSchemaDataset path: data/model schema: my_package.artschema:TorchModelSchema # fully qualified class name
Usage with inferred schema
Register the schema in the model’s tags (also valid for experiments, runs and model versions):
import mlopus mlopus.artschema.Tags() \ .with( my_package.artschema.TorchModelSchema, aliased_as="torch_model", ) \ .register( mlopus.mlflow.get_api().get_or_create_model("my_lang_model") )
Reference the schema by alias:
# conf/<env>/catalog.yml model: type: mlopus.kedro.ArtifactSchemaDataset path: data/model schema: torch_model # Get schema with this alias subject: {model_name: my_lang_model} # from this model's tags mlflow: ${globals:mlflow} # using this MLflow API handle.
-
field path:
Path
[Required] Target path for saving/loading artifact file or dir.
- field run_manager: MlflowRunManager | None [Required] (alias 'mlflow')
Instance or dict to be parsed into instance of
MlflowRunManager
-
field skip_reqs_check:
bool
= False See
skip_reqs_check
-
field subject:
UnionType
[ExpSubject
,RunSubject
,ModelSubject
,None
] = None If
schema_
is an alias to a previously registered artifact schema, load the respective schema class from this subject’s tags. See alsoparse_subject()
.
- class Config
Bases:
object
Pydantic class config.
- pydantic model mlopus.kedro.datasets.artschema.ExpSubject[source]
Bases:
SchemaSubject[ExpApi]
Specifies an experiment as subject for artifact schema inferrence.
-
field exp_name:
str
[Required] Experiment name. Defaults to the experiment used in the
run_manager
-
field exp_name:
- pydantic model mlopus.kedro.datasets.artschema.RunSubject[source]
Bases:
SchemaSubject[RunApi]
Specifies a run as subject for artifact schema inferrence.
-
field run_id:
str
[Required] Run ID. Defaults to the run used in the
run_manager
-
field run_id: