nvflare.app_opt.pt.quantization.quantizer module

class ModelQuantizer(quantization_type='float16')[source]

Bases: DXOFilter

Filter to quantize Shareable object to reduce communication burden.

Parameters:

quantization_type – method used for quantization

process_dxo(dxo: DXO, shareable: Shareable, fl_ctx: FLContext) None | DXO[source]

Filter process apply to the Shareable object.

Parameters:
  • dxo – data to be processed

  • shareable – that the dxo belongs to

  • fl_ctx – FLContext

Returns: DXO object with quantized weights

quantization(params: dict, fl_ctx: FLContext)[source]