Skip to main content

SaveModelUnit

Unit
DashAI.back.units.SaveModelUnit

Write a trained model under the runs directory, in its own subdirectory.

The destination is named by artifact_prefix, which the caller chooses: a run passes its own id, so a re-run overwrites its own artifact and never another's. A caller that is not a run passes something unique to itself.

The prefix is configuration rather than a context key on purpose: no unit publishes it, so nothing upstream could ever satisfy it as a requirement. It is the same split SaveDatasetUnit and SaveDatasetToPathUnit already draw — a destination an upstream unit produced against one the caller names.

Methods​

execute(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on SaveModelUnit

Do the unit's work, reading from and writing to the context.

Parameters

ctx : ExecutionContext
The shared execution context.

validate(self, ctx: DashAI.back.units.context.ExecutionContext) -> None

Defined on SaveModelUnit

Check preconditions without executing the unit.

Parameters

ctx : ExecutionContext
The shared execution context.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.