vlm: optimize tensor transport (#6003)

Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
This commit is contained in:
Mick
2025-07-26 17:41:01 +08:00
committed by GitHub
co-authored by Xinyuan Tong
parent 534756749a
commit 3212c2ad3f
23 changed files with 221 additions and 60 deletions
+19
View File
@@ -14,6 +14,7 @@ import traceback
import urllib.request
import weakref
from concurrent.futures import ThreadPoolExecutor
from functools import wraps
from io import BytesIO
from json import dumps
from typing import Any, Callable, List, Optional, Tuple, Type, Union
@@ -28,6 +29,24 @@ from tqdm import tqdm
logger = logging.getLogger(__name__)
def execute_once(func):
has_run = None
@wraps(func)
def wrapper(*args, **kwargs):
nonlocal has_run
if not has_run:
func(*args, **kwargs)
has_run = True
return wrapper
@execute_once
def info_once(message: str):
logger.info(message)
def convert_json_schema_to_str(json_schema: Union[dict, str, Type[BaseModel]]) -> str:
"""Convert a JSON schema to a string.
Parameters