llmcompressor.modeling.fuse
Functions:
-
center_embeddings
–Shift each embedding to have a mean of zero
-
fuse_norm_linears
–Fuse the scaling operation of norm layer into subsequent linear layers.
center_embeddings
Shift each embedding to have a mean of zero
Parameters:
-
embedding
Module
) –embedding module containing embeddings to center
Source code in llmcompressor/modeling/fuse.py
fuse_norm_linears
Fuse the scaling operation of norm layer into subsequent linear layers. This useful for ensuring transform invariance between norm and linear layers.
Note that unitary transforms (rotation) commute with normalization, but not scaling
Parameters:
-
norm
Module
) –norm layer whose weight will be fused into subsequent linears
-
linears
Iterable[Linear]
) –linear layers which directly follow the norm layer