Add SGLANG_SORT_WEIGHT_FILES env var for sequential I/O optimization (#20194)
Signed-off-by: zhaoshang <zhaoshangsjtu@linux.alibaba.com>
This commit is contained in:
@@ -39,6 +39,7 @@ from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import (
|
||||
)
|
||||
from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger
|
||||
from sglang.multimodal_gen.utils import PRECISION_TO_TYPE
|
||||
from sglang.srt.environ import envs
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
@@ -126,6 +127,9 @@ class TextEncoderLoader(ComponentLoader):
|
||||
f"Cannot find any model weights with `{model_name_or_path}`"
|
||||
)
|
||||
|
||||
if envs.SGLANG_SORT_WEIGHT_FILES.get():
|
||||
hf_weights_files.sort()
|
||||
|
||||
return hf_folder, hf_weights_files, use_safetensors
|
||||
|
||||
def _get_weights_iterator(
|
||||
|
||||
@@ -161,6 +161,7 @@ class Envs:
|
||||
|
||||
# Model & File Download
|
||||
SGLANG_USE_MODELSCOPE = EnvBool(False)
|
||||
SGLANG_SORT_WEIGHT_FILES = EnvBool(False)
|
||||
SGLANG_DISABLED_MODEL_ARCHS = EnvTuple(tuple())
|
||||
|
||||
# Logging Options
|
||||
|
||||
@@ -469,6 +469,9 @@ class DefaultModelLoader(BaseModelLoader):
|
||||
f"Cannot find any model weights with `{model_name_or_path}`"
|
||||
)
|
||||
|
||||
if envs.SGLANG_SORT_WEIGHT_FILES.get():
|
||||
hf_weights_files.sort()
|
||||
|
||||
return hf_folder, hf_weights_files, use_safetensors
|
||||
|
||||
def _get_weights_iterator(
|
||||
|
||||
Reference in New Issue
Block a user