Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/sglang/srt/configs/load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class LoadFormat(str, enum.Enum):
REMOTE_INSTANCE = "remote_instance"
RDMA = "rdma"
LOCAL_CACHED = "local_cached"
PRIVATE = "private"


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion python/sglang/srt/model_executor/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def get_weight_iter(config):
return iter

def model_load_weights(model, iter):
DefaultModelLoader.load_weights_and_postprocess(model, iter, target_device)
loader.load_weights_and_postprocess(model, iter, target_device)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already enforces that the loader needs to be an DefaultModelLoader instance in L942

return model

with set_default_torch_dtype(self.model_config.dtype):
Expand Down
8 changes: 8 additions & 0 deletions python/sglang/srt/model_loader/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2100,4 +2100,12 @@ def get_model_loader(
if load_config.load_format == LoadFormat.REMOTE_INSTANCE:
return RemoteInstanceModelLoader(load_config)

if load_config.load_format == LoadFormat.PRIVATE:
import importlib
try:
module = importlib.import_module("sglang.private.private_model_loader")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use importlib to avoid circular deps lint

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw for circular deps lint another way may be use comments # noqa: ... etc to ignore it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lint showed up on the private lib part lol

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see

return module.PrivateModelLoader(load_config)
except ImportError:
raise ValueError("Failed to import sglang.private.private_model_loader")

return DefaultModelLoader(load_config)
2 changes: 1 addition & 1 deletion python/sglang/srt/models/qwen2_5_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
if name in params_dict.keys():
param = params_dict[name]
else:
continue
raise ValueError(f"Weight {name} not found in params_dict")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except KeyError:
print(params_dict.keys())
raise
Expand Down
1 change: 1 addition & 0 deletions python/sglang/srt/server_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"layered",
"remote",
"remote_instance",
"private",
]

QUANTIZATION_CHOICES = [
Expand Down
Loading