vllm.model_executor.utils ¶
Utils for model executor.
get_moe_expert_mapping ¶
Source code in vllm/model_executor/utils.py
get_packed_modules_mapping ¶
Source code in vllm/model_executor/utils.py
maybe_disable_graph_partition ¶
replace_parameter ¶
Replace a parameter of a layer while maintaining the ability to reload the weight. Called within implementations of the process_weights_after_loading method.
This function should not be called on weights which are tied/shared
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer | Module | Layer containing parameter to replace | required |
param_name | str | Name of parameter to replace | required |
new_data | Tensor | New data of the new parameter | required |
Source code in vllm/model_executor/utils.py
set_weight_attrs ¶
Set attributes on a weight tensor.
This method is used to set attributes on a weight tensor. This method will not overwrite existing attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight | Tensor | The weight tensor. | required |
weight_attrs | dict[str, Any] | None | A dictionary of attributes to set on the weight tensor. | required |