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

This commit is contained in:
Xinyu Yang
2024-09-30 02:02:40 +08:00
committed by GitHub
parent 048685430d
commit acaffd233f
2 changed files with 14 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ limitations under the License.
"""Common utilities."""
import base64
import ipaddress
import logging
import os
import pickle
@@ -54,6 +55,14 @@ def is_hip() -> bool:
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():
global show_time_cost
show_time_cost = True