Tiny refactor condition to requant scale ue8m0 (#13286)
This commit is contained in:
@@ -12,6 +12,7 @@ from torch import nn
|
||||
from transformers.dynamic_module_utils import get_class_from_dynamic_module
|
||||
|
||||
from sglang.srt.configs.model_config import ModelConfig, ModelImpl
|
||||
from sglang.srt.layers import deep_gemm_wrapper
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -119,6 +120,15 @@ def post_load_weights(model: nn.Module, model_config: ModelConfig):
|
||||
model.post_load_weights()
|
||||
|
||||
|
||||
def should_deepgemm_weight_requant_ue8m0(weight_block_size):
|
||||
"""Should we requant fp8 weights into UE8M0 format when loading the model"""
|
||||
return (
|
||||
deep_gemm_wrapper.ENABLE_JIT_DEEPGEMM
|
||||
and deep_gemm_wrapper.DEEPGEMM_SCALE_UE8M0
|
||||
and weight_block_size is not None
|
||||
)
|
||||
|
||||
|
||||
def should_async_load(weight: torch.Tensor) -> bool:
|
||||
"""Return True if we should load the given weight asynchronously.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user