ls_mlkit.util.dequantize module

class ls_mlkit.util.dequantize.Config[source]

Bases: object

device = 'cuda'
in_features = 3
out_features = 4
ls_mlkit.util.dequantize.dequantize(model, dtype) None[source]

Dequantize a model

Parameters:
  • model (torch.nn.Module) – the model to dequantize

  • dtype (str) – the dtype of the model

Returns:

None

ls_mlkit.util.dequantize.get_float_weight(model: Module)[source]

Get the float weight of a model

Parameters:

model (torch.nn.Module) – the model to get the float weight

Returns:

the float weight of the model

Return type:

torch.Tensor

ls_mlkit.util.dequantize.main()[source]
ls_mlkit.util.dequantize.replace_module_with_linear(model: Module, target) None[source]

Replace a module with a linear layer

Parameters:
  • model (torch.nn.Module) – the model to replace the module

  • target (torch.nn.Module) – the target module to replace

Returns:

None