Skip to content

base

base

Policy deployment backend contracts.

DeploymentArtifact dataclass

DeploymentArtifact(converted_model, example_inputs, model_filename, artifact_format, backend_name, model_bytes=None)

Artifact emitted by a deployment backend.

DeploymentBackend

Bases: ABC

Base class for deployment artifact generation.

export abstractmethod

export(model, example_inputs)

Create a deployment artifact from an exportable PyTorch module.

Source code in src/versatil/post_training_compression/deployment_backends/base.py
@abstractmethod
def export(
    self,
    model: nn.Module,
    example_inputs: tuple[torch.Tensor, ...],
) -> DeploymentArtifact:
    """Create a deployment artifact from an exportable PyTorch module."""