Edit on GitHub

MLEM Objects

MLEM Objects are instances of one of the subclasses of MlemObject class. MLEM is using extended pydantic functionality to save and load them from files.

You can get MlemObject instance if you use load_meta API method instead of simple load.

See also MLEM Object API

Common fields

Each MLEM Object has an object_type field which determines the type of the object. Specific types may have additional properties, but all MLEM Objects have the following fields:

  • params - arbitrary object with additional parameters
  • location - if the object is loaded, information about where it came from

You can check out what methods MLEM Objects have in API Reference

MLEM Object Types

These are the builtin types of MLEM Objects.

Model

Represents an ML model, but can be generalized to any model or even any "function" or any "transformation", thanks to callable ModelType.

Base class: mlem.core.objects.MlemModel

Fields (in addition to inherited):

  • model_type (lazy) - ModelType, which is polymorphic and holds metadata about model's framework, methods and io.
  • artifacts - a string-to-artifacts mapping. Artifact instances represent a file stored somewhere (local/cloud/dvc cache etc.)
  • requirements - a list of Requirement instances, needed to use that object in runtime

Data

Represent data, which can be used as an input to one of Model's methods.

Base class: mlem.core.objects.MlemData

Fields (in addition to inherited):

  • reader (lazy) - DataReader - how to read saved files and resulting dataset metadata
  • data_type (transient) - DataType with dataset value and metadata (available once data is read)
  • artifacts - a string-to-artifacts mapping. Artifact instances represent a file stored somewhere (local/cloud/dvc cache etc.)
  • requirements - a list of Requirement instances, needed to use that object in runtime

Represents a link (pointer) to another MLEM Object. More on that here

Base class: mlem.core.objects.MlemLink

Fields (in addition to inherited):

  • path - path to MLEM Object
  • project - location of MLEM Project with referenced object
  • rev - revision of the object
  • link_type - type of the referenced object

Other types

Some of the MLEM ABCs are also MLEM Objects:

Content

šŸ› Found an issue? Let us know! Or fix it:

Edit on GitHub

ā“ Have a question? Join our chat, we will help you:

Discord Chat