Fix update_weights deadlock for DP (#1825)

This commit is contained in:
Byron Hsu
2024-10-28 12:02:23 -07:00
committed by GitHub
parent 3839be2913
commit 0a24eb850a
2 changed files with 67 additions and 13 deletions

View File

@@ -1,6 +1,9 @@
import time
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_child_process
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
@@ -39,6 +42,26 @@ class TestDataParallelism(unittest.TestCase):
metrics = run_eval(args)
assert metrics["score"] >= 0.65
def test_update_weight(self):
response = requests.post(
self.base_url + "/update_weights",
json={"model_path": DEFAULT_MODEL_NAME_FOR_TEST},
)
# check if the response is 200
assert response.status_code == 200
# pause a few seconds then send again
time.sleep(5)
response = requests.post(
self.base_url + "/update_weights",
json={"model_path": DEFAULT_MODEL_NAME_FOR_TEST},
)
# check if the response is 200
assert response.status_code == 200
if __name__ == "__main__":
unittest.main()