Skip to content

vllm.model_executor.models.transformers.fusers.glu

GLU projection fuser: act(gate(x)) * up(x) -> a fused gate/up linear.

Classes:

  • ActAndMulQuant –

    act that can fuse with the input quantization of the linear it feeds.

  • GLUFuser –

    Fuser for the GLU pattern act(gate(x)) * up(x).

ActAndMulQuant

Bases: Module

act that can fuse with the input quantization of the linear it feeds.

GLUFuser dataclass

Bases: MergedColumnParallelFuser

Fuser for the GLU pattern act(gate(x)) * up(x).

Methods:

  • update_forward –

    Replace act(gate(x)) * up(x) with act(gate_up(x)) in source.

_get_act_and_mul(act) classmethod

Get the ...AndMul equivalent of a Transformers activation module.

_get_act_and_mul_name(act) staticmethod

Get the name of act if it has an ...AndMul equivalent.

_get_glu_nodes(graph, module) classmethod

Search graph for the GLU pattern act(gate(x)) * up(x).

_is_act_of_gate(node, module) classmethod

Is node act(gate(x)) where gate is linear and act is not linear.

update_forward(module)

Replace act(gate(x)) * up(x) with act(gate_up(x)) in source.