nemo_rl.modelopt.models.generation.vllm_modelopt_patch#
vLLM ModelOpt NVFP4 patches for dense rollout weight reloads.
Module Contents#
Functions#
Convert dense ModelOpt NVFP4 W4A16 weights for Marlin weight-only GEMM. |
|
Convert dense ModelOpt NVFP4 weights after initial load or refit. |
|
Prepare a dense ModelOpt-vLLM model for one weight reload cycle. |
|
Run vLLM ModelOpt post-load processing for dense quantized layers. |
|
Patch vLLM’s dense ModelOpt NVFP4 method for rollout refits. |
Data#
API#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._DENSE_HF_PARAMS#
(‘weight’, ‘weight_scale’, ‘weight_scale_2’)
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._MODELOPT_W4A16_QUANT_MODES#
‘frozenset(…)’
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._MODELOPT_W4A16_ATTR#
‘_nrl_weight_only_w4a16’
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._ORIGINAL_NVFP4_CONFIG_FROM_CONFIG_ATTR#
‘_nrl_original_from_config’
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._ORIGINAL_LINEAR_APPLY_ATTR#
‘_nrl_original_apply’
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._unwrap_vllm_model(model: torch.nn.Module) torch.nn.Module#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._canonicalize_nvfp4_weight_scale(layer: torch.nn.Module) None#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._requests_w4a16_modelopt_config(config: dict) bool#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._is_w4a16_modelopt_quant_config(quant_config) bool#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._modelopt_nvfp4_config_from_config(cls, *args, **kwargs)#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._convert_nvfp4_linear_kernel_format(
- quant_method,
- layer: torch.nn.Module,
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._convert_w4a16_linear_kernel_format(layer: torch.nn.Module) None#
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._capture_modelopt_dense_param_reload_meta(
- layer: torch.nn.Module,
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._modelopt_dense_process_w4a16_weights(
- self,
- layer: torch.nn.Module,
Convert dense ModelOpt NVFP4 W4A16 weights for Marlin weight-only GEMM.
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._modelopt_dense_process_weights(self, layer: torch.nn.Module) None#
Convert dense ModelOpt NVFP4 weights after initial load or refit.
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._modelopt_dense_apply(
- self,
- layer: torch.nn.Module,
- x: torch.Tensor,
- bias: torch.Tensor | None = None,
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch.prepare_modelopt_for_weight_reload(model, device=None) None#
Prepare a dense ModelOpt-vLLM model for one weight reload cycle.
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch.modelopt_process_weights_after_loading(model) None#
Run vLLM ModelOpt post-load processing for dense quantized layers.
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch._patched#
False
- nemo_rl.modelopt.models.generation.vllm_modelopt_patch.apply_modelopt_nvfp4_patches() None#
Patch vLLM’s dense ModelOpt NVFP4 method for rollout refits.