peft.quantize

peft.quantize#

gemma.peft.quantize(
params: gemma.peft._quantization_utils.PyTree,
*,
method: gemma.peft._quantization_utils.QuantizationMethod | str,
checkpoint_kernel_key: str = 'w',
in_place_keys: bool = False,
) gemma.peft._quantization_utils.PyTree[source]

量化给定的参数。

在这个API中,我们转换参数的元素以实际获得量化值。目前仅限于INT$逐通道权重​​量化。

参数:
  • params – 要量化的参数。

  • method – 要使用的量化方法。

  • checkpoint_kernel_key – 检查点中内核的键(在预训练检查点中为 ‘w’)。

  • in_place_keys – 是否就地量化键。

返回:

量化后的参数。