Model Version API

pydantic model mlopus.mlflow.ModelVersionApi[source]

Bases: ModelVersion, EntityApi

Model version metadata with MLflow API handle.

field model: ModelApi [Required]

Parent model.

field path_in_run: str [Required]

Path inside run artifacts.

field run: RunApi [Required]

Parent run.

field tags: Dict[str, Any] [Required]

Nested tags dict with JSON-serializable leaf-values and keys in the pattern: [w-/]+

field version: str [Required]

Model version in the pattern [w-.]+

class Config

Bases: object

Pydantic class config.

cache()[source]

Cache metadata and artifact for this model version.

cache_artifact()[source]

Pull artifact of this model version from MLflow server to local cache.

Return type:

Path

cache_meta()[source]

Fetch latest metadata for this model version and save it to cache.

Return type:

ModelVersionApi

clean_cached_artifact()[source]

Clean cached artifact for this model version.

export(target)[source]

Export metadata and artifact cache of this model version to target path.

Parameters:

target (Path) – Cache export path.

export_artifact(target)[source]

Export model version artifact cache to target.

Parameters:

target (Path) – Cache export path.

Return type:

Path

export_meta(target)[source]

Export model version metadata cache to target.

Parameters:

target (Path) – Cache export path.

Return type:

ModelVersionApi

get_artifact()[source]

Get local path to model artifact. :rtype: Path

list_artifacts(path_suffix='')[source]

List artifacts in this model version.

Parameters:

path_suffix (str) – Plain relative path inside model artifact dir (e.g.: a/b/c).

Return type:

Union[List[ObjMeta], ObjMeta]

load_artifact(loader)[source]

Load model version artifact.

Parameters:

loader (Callable[[Path], TypeVar(A)]) – Loader callback.

Return type:

TypeVar(A)

place_artifact(target, overwrite=False, link=True)[source]

Place model version artifact on target path.

Parameters:
  • target (Path) – Target path.

  • overwrite (bool) – Overwrite target path if exists.

  • link (bool) – Use symbolic link instead of copy.

set_tags(tags)[source]

Set tags on this model version.

Parameters:

tags (Mapping) – See schema.Model.tags.

Return type:

ModelVersionApi

update()

Use API to get latest data for this entity and update this entity in place.

Return type:

EntityApi

property url: str

Get model version URL.