Spaces:
Running
Running
github-actions[bot]
commited on
Commit
·
956a55c
1
Parent(s):
f95da0a
Auto-sync from demo at Wed Nov 12 09:59:50 UTC 2025
Browse files
graphgen/models/llm/local/sglang_wrapper.py
CHANGED
|
@@ -16,6 +16,7 @@ class SGLangWrapper(BaseLLMWrapper):
|
|
| 16 |
temperature: float = 0.0,
|
| 17 |
top_p: float = 1.0,
|
| 18 |
topk: int = 5,
|
|
|
|
| 19 |
**kwargs: Any,
|
| 20 |
):
|
| 21 |
super().__init__(temperature=temperature, top_p=top_p, **kwargs)
|
|
@@ -32,9 +33,10 @@ class SGLangWrapper(BaseLLMWrapper):
|
|
| 32 |
self.temperature = temperature
|
| 33 |
self.top_p = top_p
|
| 34 |
self.topk = topk
|
|
|
|
| 35 |
|
| 36 |
# Initialise the offline engine
|
| 37 |
-
self.engine = sgl.Engine(model_path=self.model_path)
|
| 38 |
|
| 39 |
# Keep helpers for streaming
|
| 40 |
self.async_stream_and_merge = async_stream_and_merge
|
|
@@ -145,4 +147,6 @@ class SGLangWrapper(BaseLLMWrapper):
|
|
| 145 |
def restart(self) -> None:
|
| 146 |
"""Restart the SGLang engine."""
|
| 147 |
self.shutdown()
|
| 148 |
-
self.engine = self.engine.__class__(
|
|
|
|
|
|
|
|
|
| 16 |
temperature: float = 0.0,
|
| 17 |
top_p: float = 1.0,
|
| 18 |
topk: int = 5,
|
| 19 |
+
tp_size: int = 1,
|
| 20 |
**kwargs: Any,
|
| 21 |
):
|
| 22 |
super().__init__(temperature=temperature, top_p=top_p, **kwargs)
|
|
|
|
| 33 |
self.temperature = temperature
|
| 34 |
self.top_p = top_p
|
| 35 |
self.topk = topk
|
| 36 |
+
self.tp_size = int(tp_size)
|
| 37 |
|
| 38 |
# Initialise the offline engine
|
| 39 |
+
self.engine = sgl.Engine(model_path=self.model_path, tp_size=tp_size)
|
| 40 |
|
| 41 |
# Keep helpers for streaming
|
| 42 |
self.async_stream_and_merge = async_stream_and_merge
|
|
|
|
| 147 |
def restart(self) -> None:
|
| 148 |
"""Restart the SGLang engine."""
|
| 149 |
self.shutdown()
|
| 150 |
+
self.engine = self.engine.__class__(
|
| 151 |
+
model_path=self.model_path, tp_size=self.tp_size
|
| 152 |
+
)
|