[VLM] Merged multi-modal processor for Molmo (#12966)
This commit is contained in:
@@ -33,8 +33,7 @@ from dataclasses import dataclass, field
|
||||
from functools import cache, lru_cache, partial, wraps
|
||||
from typing import (TYPE_CHECKING, Any, AsyncGenerator, Awaitable, Callable,
|
||||
Dict, Generator, Generic, Iterator, List, Literal,
|
||||
NamedTuple, Optional, Tuple, Type, TypeVar, Union,
|
||||
overload)
|
||||
NamedTuple, Optional, Tuple, Type, TypeVar, Union)
|
||||
from uuid import uuid4
|
||||
|
||||
import cloudpickle
|
||||
@@ -826,38 +825,6 @@ JSONTree = Union[Dict[str, "JSONTree[T]"], List["JSONTree[T]"],
|
||||
"""A nested JSON structure where the leaves need not be JSON-serializable."""
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[T], U],
|
||||
value: Dict[str, JSONTree[T]],
|
||||
) -> Dict[str, JSONTree[U]]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[T], U],
|
||||
value: List[JSONTree[T]],
|
||||
) -> List[JSONTree[U]]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[T], U],
|
||||
value: Tuple[JSONTree[T], ...],
|
||||
) -> Tuple[JSONTree[U], ...]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[T], U],
|
||||
value: JSONTree[T],
|
||||
) -> JSONTree[U]:
|
||||
...
|
||||
|
||||
|
||||
def json_map_leaves(func: Callable[[T], U], value: JSONTree[T]) -> JSONTree[U]:
|
||||
if isinstance(value, dict):
|
||||
return {k: json_map_leaves(func, v) for k, v in value.items()}
|
||||
|
||||
Reference in New Issue
Block a user