Fix a distributed initialization error (#13843)
Signed-off-by: Zhiyu Cheng <zhiyuc@nvidia.com>
This commit is contained in:
@@ -61,6 +61,7 @@ from sglang.srt.connector.utils import parse_model_name
|
||||
from sglang.srt.distributed import (
|
||||
get_tensor_model_parallel_rank,
|
||||
get_tensor_model_parallel_world_size,
|
||||
model_parallel_is_initialized,
|
||||
)
|
||||
from sglang.srt.layers.modelopt_utils import QUANT_CFG_CHOICES
|
||||
from sglang.srt.layers.quantization.base_config import QuantizationConfig
|
||||
@@ -1863,7 +1864,10 @@ class ModelOptModelLoader(DefaultModelLoader):
|
||||
# Apply quantization
|
||||
mtq.quantize(model, quant_cfg, forward_loop=calibrate_loop)
|
||||
|
||||
if get_tensor_model_parallel_rank() == 0:
|
||||
if (
|
||||
not model_parallel_is_initialized()
|
||||
or get_tensor_model_parallel_rank() == 0
|
||||
):
|
||||
mtq.print_quant_summary(model)
|
||||
|
||||
# Save checkpoint if path provided
|
||||
|
||||
@@ -1171,9 +1171,12 @@ def set_ulimit(target_soft_limit=65535):
|
||||
|
||||
|
||||
def rank0_log(msg: str):
|
||||
from sglang.srt.distributed import get_tensor_model_parallel_rank
|
||||
from sglang.srt.distributed import (
|
||||
get_tensor_model_parallel_rank,
|
||||
model_parallel_is_initialized,
|
||||
)
|
||||
|
||||
if get_tensor_model_parallel_rank() == 0:
|
||||
if not model_parallel_is_initialized() or get_tensor_model_parallel_rank() == 0:
|
||||
logger.info(msg)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user