[Fix] fix ipv6 url when warm up model (#1537)
This commit is contained in:
@@ -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,7 +570,10 @@ 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):
|
||||||
return f"http://{self.host}:{self.port}"
|
if is_ipv6(self.host):
|
||||||
|
return f"http://[{self.host}]:{self.port}"
|
||||||
|
else:
|
||||||
|
return f"http://{self.host}:{self.port}"
|
||||||
|
|
||||||
def check_server_args(self):
|
def check_server_args(self):
|
||||||
assert (
|
assert (
|
||||||
|
|||||||
@@ -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:
|
|||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user