Skip to content

vllm.model_executor.models.llama4

Inference-only LLaMA model compatible with HuggingFace weights.

Classes:

Llama4Model

Bases: LlamaModel

Methods:

load_moe_expert_weights(name, loaded_weight, params_dict, loaded_params, expert_params_mapping, fused=True)

Load MoE expert weights.

Parameters:

  • name

    (str) –

    The name of the weight to load.

  • loaded_weight

    (Tensor) –

    The weight to load.

  • params_dict

    (dict[str, Parameter]) –

    The dictionary of module parameters.

  • loaded_params

    (set[str]) –

    The set of already loaded parameters.

  • expert_params_mapping

    (list[tuple[str, str, int, str]]) –

    The mapping of expert parameters. Must be generated by fused_moe_make_expert_params_mapping().

  • fused

    (bool, default: True ) –

    Whether the expert weights are fused into a single weight tensor or are separate weight tensors for each expert. When fused is True, loaded_weight should have shape of: [num_experts, hidden_in, hidden_out] for gate/up/down proj and [hidden_out, hidden_in] for the others like router. When fused is False, loaded_weight should have shape of: [hidden_out, hidden_in].

Returns:

  • bool –

    True if loaded_weight is one of MoE weights and the MoE expert

  • bool –

    weights are loaded successfully, False otherwise.