Unverified Commit acaffd23 authored by Xinyu Yang's avatar Xinyu Yang Committed by GitHub
Browse files

[Fix] fix ipv6 url when warm up model (#1537)

parent 04868543
...@@ -21,7 +21,7 @@ import logging ...@@ -21,7 +21,7 @@ import logging
import random import random
from typing import List, Optional, Union from typing import List, Optional, Union
from sglang.srt.utils import is_hip from sglang.srt.utils import is_hip, is_ipv6
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -570,6 +570,9 @@ class ServerArgs: ...@@ -570,6 +570,9 @@ class ServerArgs:
return cls(**{attr: getattr(args, attr) for attr in attrs}) return cls(**{attr: getattr(args, attr) for attr in attrs})
def url(self): def url(self):
if is_ipv6(self.host):
return f"http://[{self.host}]:{self.port}"
else:
return f"http://{self.host}:{self.port}" return f"http://{self.host}:{self.port}"
def check_server_args(self): def check_server_args(self):
......
...@@ -16,6 +16,7 @@ limitations under the License. ...@@ -16,6 +16,7 @@ limitations under the License.
"""Common utilities.""" """Common utilities."""
import base64 import base64
import ipaddress
import logging import logging
import os import os
import pickle import pickle
...@@ -54,6 +55,14 @@ def is_hip() -> bool: ...@@ -54,6 +55,14 @@ def is_hip() -> bool:
return torch.version.hip is not None return torch.version.hip is not None
def is_ipv6(address):
try:
ipaddress.IPv6Address(address)
return True
except ipaddress.AddressValueError:
return False
def enable_show_time_cost(): def enable_show_time_cost():
global show_time_cost global show_time_cost
show_time_cost = True show_time_cost = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment