easydel.layers.quantization.linear_nf4#

class easydel.layers.quantization.linear_nf4.LinearNF4(*args: Any, **kwargs: Any)[source]#

Bases: QauntModule

A 4-bit quantized version of the linear transformation using NF4 quantization.

Uses eformer’s ArrayNF4 implicit array for efficient 4-bit NormalFloat quantization.

classmethod from_linear(linear: Linear, rngs: flax.nnx.rnglib.Rngs | None = None, block_size: int = 64, **kwargs) LinearNF4[source]#

Create a LinearNF4 module from a regular Linear module.

get_kernel()[source]#

Get the dequantized kernel weights.

get_quantized_kernel()[source]#

Get the quantized kernel weights and scales.

static metadata()[source]#
static quantization_mapping()[source]#
to_linear(rngs: flax.nnx.rnglib.Rngs | None = None) Linear[source]#

Convert this LinearNF4 module back to a regular Linear module.