config: borrowed-record reads follow the config bags (#35908)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
64aa859da2
commit
362c2ee849
@@ -66,13 +66,24 @@ class _FakeHttpTokenizerManager:
|
||||
pp_size=1,
|
||||
enable_dp_attention=False,
|
||||
):
|
||||
from sglang.srt.runtime_context import get_context
|
||||
|
||||
self.loads = loads
|
||||
self.server_args = SimpleNamespace(
|
||||
# `tp_size` is raw input and still read off the record; the leaves
|
||||
# resolution writes come from the bags.
|
||||
self.server_args = SimpleNamespace(tp_size=tp_size)
|
||||
# The accelerator arithmetic answers "what will this server do", so it
|
||||
# reads the resolved topology out of the bags; publish the shape under test.
|
||||
self._override = get_context().override_server_args(
|
||||
tp_size=tp_size,
|
||||
dp_size=dp_size,
|
||||
pp_size=pp_size,
|
||||
enable_dp_attention=enable_dp_attention,
|
||||
)
|
||||
self._override.install()
|
||||
|
||||
def restore(self):
|
||||
self._override.restore()
|
||||
|
||||
async def get_loads(self, include=None, dp_rank=None):
|
||||
results = []
|
||||
@@ -95,6 +106,7 @@ class TestLoadsResponse(CustomTestCase):
|
||||
)
|
||||
]
|
||||
)
|
||||
self.addCleanup(manager.restore)
|
||||
|
||||
response = asyncio.run(get_loads(tokenizer_manager=manager))
|
||||
|
||||
@@ -111,6 +123,7 @@ class TestLoadsAcceleratorField(CustomTestCase):
|
||||
"""Guards the response contract: the JSON envelope carries an
|
||||
accelerator name and the accelerator count for each DP rank."""
|
||||
manager = _FakeHttpTokenizerManager([LoadSnapshot(dp_rank=0)], tp_size=16)
|
||||
self.addCleanup(manager.restore)
|
||||
|
||||
with mock.patch.object(
|
||||
v1_loads, "_accelerator_name", return_value="NVIDIA GB300"
|
||||
@@ -126,6 +139,7 @@ class TestLoadsAcceleratorField(CustomTestCase):
|
||||
dp_size=8,
|
||||
enable_dp_attention=True,
|
||||
)
|
||||
self.addCleanup(manager.restore)
|
||||
|
||||
response = asyncio.run(get_loads(tokenizer_manager=manager))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user