dmx.compressor.plugins

Classes

ActivatePlugins(plugins)

PluginBase()

PluginLayerData(input_before_cast, ...)

class dmx.compressor.plugins.ActivatePlugins(plugins: PluginBase | List[PluginBase])

Bases: object

applied_to(model: DmxModel)
class dmx.compressor.plugins.PluginBase

Bases: ABC

abstractmethod process_layer(layer_data: PluginLayerData)

Define here the transformations that depend on a calibration input. This function will be called for each layer (DmxModule) with the layer inputs and outputs. These come from the calibration data you call the model with. You have to call the model with this calibration data

abstractmethod process_model(model: DmxModel)

Define here the model transformations that do not depend on a calibration input. For example, layernorm scale computation using SLANC

class dmx.compressor.plugins.PluginLayerData(input_before_cast: torch.Tensor | List[torch.Tensor], input_after_cast: torch.Tensor | List[torch.Tensor], output_before_cast: torch.Tensor | List[torch.Tensor], output_after_cast: torch.Tensor | List[torch.Tensor], mod: 'DmxModule', args: List[Any], kwargs: Dict[str, Any])

Bases: object

args: List[Any]
input_after_cast: Tensor | List[Tensor]
input_before_cast: Tensor | List[Tensor]
kwargs: Dict[str, Any]
mod: DmxModule
output_after_cast: Tensor | List[Tensor]
output_before_cast: Tensor | List[Tensor]