Deprecate global_server_args_dict (#11331)

This commit is contained in:
Liangsheng Yin
2025-10-13 01:20:47 +08:00
committed by GitHub
parent 2157d12ae8
commit 1083e7e3df
54 changed files with 240 additions and 321 deletions

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
# ruff: noqa: SIM117
import collections
import concurrent
import dataclasses
import fnmatch
import glob
@@ -12,12 +11,10 @@ import json
import logging
import math
import os
import re
import socket
import threading
import time
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager, suppress
from typing import (
TYPE_CHECKING,
@@ -33,10 +30,10 @@ from typing import (
import huggingface_hub
import numpy as np
import requests
import safetensors.torch
import torch
from sglang.srt.server_args import get_global_server_args
# Try to import accelerate (optional dependency)
try:
from accelerate import infer_auto_device_map, init_empty_weights
@@ -81,8 +78,6 @@ DEFAULT_GPU_MEMORY_FRACTION_FOR_CALIBRATION = (
0.8 # Reserve 20% GPU memory headroom for ModelOpt calibration
)
from sglang.srt.model_loader.weight_utils import (
_BAR_FORMAT,
default_weight_loader,
download_safetensors_index_file_from_hf,
download_weights_from_hf,
filter_duplicate_safetensors_files,
@@ -445,10 +440,8 @@ class DefaultModelLoader(BaseModelLoader):
hf_weights_files,
)
elif use_safetensors:
from sglang.srt.managers.schedule_batch import global_server_args_dict
weight_loader_disable_mmap = global_server_args_dict.get(
"weight_loader_disable_mmap"
weight_loader_disable_mmap = (
get_global_server_args().weight_loader_disable_mmap
)
if extra_config.get("enable_multithread_load"):
@@ -616,9 +609,9 @@ class LayeredModelLoader(DefaultModelLoader):
device_config: DeviceConfig,
) -> nn.Module:
from sglang.srt.layers.torchao_utils import apply_torchao_config_to_model
from sglang.srt.managers.schedule_batch import global_server_args_dict
from sglang.srt.server_args import get_global_server_args
torchao_config = global_server_args_dict.get("torchao_config")
torchao_config = get_global_server_args().torchao_config
target_device = torch.device(device_config.device)
with set_default_torch_dtype(model_config.dtype):